-1

Hello all I have a form and some 20 input elements inside it, On a particular event i want to remove all the elements inside it. I don't want to use remove()/removeChild() as i have to get each and every element and say remove. is there any way using which we can just remove all the elements in a form. please help

Ekata
  • 259
  • 2
  • 7
  • 21
  • I found similar question and the answer is [here](http://stackoverflow.com/questions/3955229/remove-all-child-elements-of-a-dom-node-in-javascript?answertab=active#tab-top). You can also read [this link](http://blog.matt.thomm.es/post/63915071626/removing-all-child-nodes-from-an-element) for more help. – Zeinab Abbasimazar Nov 12 '13 at 07:48

4 Answers4

4

Just empty the form using .empty()

$('form').empty()
Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
0
$('form').empty();

reference empty()

Rituraj ratan
  • 10,260
  • 8
  • 34
  • 55
0

Try this : $('form').hide();

Trident D'Gao
  • 18,973
  • 19
  • 95
  • 159
0

you can set to empty string

 $('form').html('')
Developerium
  • 7,155
  • 5
  • 36
  • 56