- Take a reference of latest jQuery in your source. I am using jquery-1.10.2.js in my example.
- In the form tag of your Web form add your controls which you would like to use in the page.
- Simply Copy and Paste the below code in the script tag :
<script type="text/javascript">
function resetFields(form) {
$(':input', form).each(function() {
var type = this.type;
var tag = this.tagName.toLowerCase(); if (type == 'text' || type == 'password' || tag == 'textarea' || type=='file')
this.value = "";
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = 0;
});
}
</script>
No comments:
Post a Comment