jquery reset value of input field code example

Example 1: form reset jquery

$('#form_id').trigger("reset");

Example 2: form reset jquery

$('#form').get(0).reset()

Example 3: clear input field jquery

$('#shares').val('');

Example 4: clear value input jquery

<body>
    <form method="" action="">
        <input type="text" name="email" class="input" />
        <input type="submit" value="Sign Up" class="button" />
    </form>
</body>

<script>
    $(document).ready(function() {
        $(".input").val("Email Address");
        $(".input").on("focus", function() {
            $(".input").val("");
        });
        $(".button").on("click", function(event) {
            $(".input").val("");
        });
    });
</script>