Quantcast
Channel: Random Thoughts » Uncategorized
Viewing all articles
Browse latest Browse all 5

JQuery – Clearing hidden fields

$
0
0
JQuery’s form plugin provides several convenient methods for clearing/resetting form element values. However, the clearForm method does not reset hidden fields. Here is a simple implementation for clearing hidden fields: jQuery.fn.clearHiddenFields = function() { return this.each(function(){ $("input[type='hidden']", this).each(function(){ this.value = ''; }); }); }; Invoking this method is very straightforward: $("#yourformid").clearHiddenFields(); or simply: $("form").clearHiddenFields();

Viewing all articles
Browse latest Browse all 5

Trending Articles