Jquery reset form no erase fields -
i need erase or empty input fields of form use no works :
<script> jquery(document).ready(function() { jquery("#contact_form").get(0).reset() }); </script> <form id="contact_form" name="form" method="post" action=""> <input name="c_name" type="text" title="insert personal name" value="personal name" /> </form>
the script must erase content of input text , no show text personal name , case it´s no works , no reset form
i dont know if exists error think must works
thank´s , regards
you cannot reset form input value defined using inline attribute, use .val()
$("#contact_form input[name=c_name]").val('');
or add button, , reset form on click event of it.
$("button").click(function(){ $("#contact_form")[0].reset(); });
note : reset()
changes value of input inital value (in case reset personal name.
Comments
Post a Comment