06 Feb 2014

Javascript, form reset and hidden fields

Quick heads up, form reset doesn’t clear values of hidden fields. To properly clear form fields and hidden inputs, you can do this in JQuery:

1
2
$("#form")[0].reset();
$("input[type=hidden]").val('');

 

My name is Opeyemi Obembe. I build things for web and mobile and write about my experiments. Follow me on Twitter–@kehers.

Next post: Tinypress update