Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html clear input after submit

use: document.getElementById("myForm").reset();
Comment

clear form value after submit

<div id="sidebar-info">
    <form name="contact-form" action="formprocess.php" method="post" target="ninja-frame">
        <h1>By Phone</h1>
        <p id="by-phone">XXX-XXX-XXXX</p>
        <h1>By Email</h1>
        <p id="form-row">Name</p>
        <input name="name" id="name" type="text" class="user-input" value="">
        <p id="form-row">Email</p>
        <input name="email" id="email" type="text" class="user-input" value="">
        <p id="form-row">Message</p>
        <textarea name="message" id="message" class="user-input" rows="10" maxlength="1500"></textarea>
        <p>*Please fill out every field</p>
        <input type="submit" value="Submit" id="submit" onclick="submitForm()">

        <script>
            function submitForm() {
            document.contact-form.submit();
            document.contact-form.reset();
            }
        </script>
    </form>
</div>
Comment

after submit how to clear form in js

$('#admin-package-add-form')[0].reset();
Comment

Jquery clear form after submit

    const clearForm = () => {
        $('#form-contact')[0].reset();
    }
Comment

PREVIOUS NEXT
Code Example
Html :: how to use lottie in html 
Html :: CKEditor in vanilla javascript 
Html :: html nav example 
Html :: give table width 100% 
Html :: iframe youtube playlist not working html 
Html :: embed tag in html 
Html :: onclick on anchor tag 
Html :: capture webcam js 
Html :: breaks html 
Html :: js download File object 
Html :: nunjucks variables 
Html :: divider bootsrap 
Html :: svg as button 
Html :: how to innerhtml is empty 
Html :: how to add an ident in html 
Html :: bootstrap 5 navbar not working 
Html :: ng-src 
Html :: link in md 
Html :: html inline elements 
Html :: select option 
Html :: scroll to a section of your page html 
Html :: html js script 
Html :: html email button 
Html :: google icons 
Html :: bootstrap + cards 
Html :: delete html 
Html :: group inputs html 
Html :: display html django template 
Html :: event in react 
Html :: Serve images in nextgen formats webp 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =