clear textbox value using id in jquery code example

Example 1: how To clear all the input element inside div using jquery

By LOVE
$('#divStaffContent').find('input:text, input:password, select')
                    .each(function () {
                        $(this).val('');
                    });
                }

Example 2: 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>

Tags:

Html Example