10 examples of 'clear form jquery' in JavaScript

Every line of 'clear form jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
228function clearForm(formId){
229 var form = jQuery('#'+formId);
230 jQuery.each(form[0].elements, function(key, val){
231 if(form[0].elements[key].type == 'text') {
232 form[0].elements[key].value = '';
233 }
234 });
235}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

69function drupalgap_form_clear(form_selector) {
70 try {
71 $(':input', form_selector)
72 .not(':button, :submit, :reset, :hidden')
73 .val('')
74 .removeAttr('checked')
75 .removeAttr('selected');
76 }
77 catch (error) { console.log('drupalgap_form_clear - ' + error); }
78}
220function clearForm($form)
221{
222 $form.find(':input').not(':button, :submit, :reset, :hidden, :checkbox, :radio').val('');
223 $form.find(':checkbox, :radio').prop('checked', false);
224}
7function clearForm()
8{
9 $(':input').not(':button, :submit, :reset, :hidden, :checkbox, :radio').val('');
10 $(':checkbox, :radio').prop('checked', false);
11 $('#search-text').focus();
12}
114function clearform(form) {
115
116 for (var i = 1; i <= form.count; i++) form.elements[i].value = "";
117
118 return true;
119
120}
42function clearForm() {
43 $('#ff').form('clear');
44 }
29function clearForm(){
30 $('#ff').form('clear');
31}
83function clearForm()
84{
85 $('#crudForm').find(':input').each(function() {
86 switch(this.type) {
87 case 'password':
88 case 'select-multiple':
89 case 'select-one':
90 case 'text':
91 case 'textarea':
92 $(this).val('');
93 break;
94 case 'checkbox':
95 case 'radio':
96 this.checked = false;
97 }
98 });
99
100 $('.remove-all').each(function(){
101 $(this).trigger('click');
102 });
103}
93function clearForm() {
94 $('#inputForm')[0].reset();
95 $('input').removeAttr("disabled");
96}
142function clearForm() {
143 $('#inputForm')[0].reset();
144}

Related snippets