Skip to content
Advertisement

get all child element of a form in J.S

how can i get all child element(like radio,checkbox,select,text,…) within a form and make them blank using javascript. My form has many other elements like table,div etc. but i dont want to changes on these other element.

Any suitable idea to get these child element(form element) through the form name(frmlist) or form id(frmlist) and make them blank. Actually i have no idea previously that how many elements are there in form and what are the names/ids of these element.

Thanks a lot…

Advertisement

Answer

Try something like this:

Example Form:

JavaScript

Example Javascript:

JavaScript

From Using Javascript to Reset or Clear Form.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement