[JQuery] actually clears the Form Content
JQuery: not () Selector
Definition and usage:
: Not () selector Selects all elements except the specified element.
The most common usage: used with other selectors to select all elements except the specified Element in the specified combination.
Reference code:
<Script> $ (function () {$ ("p: not (# p1)" ).css ("color", "red "); // write $ ("p "). not ("# p1" ).css ("color", "red"); // method 2}) </script>Hello
Hello Again
Execution result:
The html dom reset () method or Element
Reference code:
<script>$(function() {$("#form1 :input").val("value");})</script>Before clicking the reset button:
Click the reset button:
Conclusion: The html dom reset () method orThe true function of elements is not to "empty"The value in the element, but is reset to restoreThe original value in the element. It is worth noting that reset cannot reset the value of the button type element (type = button, reset, submit.
Actually clear the content in the form (JQuery)
Reference code:
<Script> $ (function () {$ ("# button "). click (function () {$ ("# form: input "). not (": button,: submit,: reset,: hidden "). val (""). removeAttr ("checked "). remove ("selected"); // core}) ;}) </script>Truly clearBefore clicking the "id = button" button:
Click "id = button: