How do I clear all the fields in a variable html content? (preferably with jQuery)

后端 未结 4 1947
天命终不由人
天命终不由人 2021-01-17 01:33

I need to reset all the form fields in an HTML content I saved in a variable. I searched the internet and here too. But none of what I\'ve found has worked yet. It won\'t su

4条回答
  •  [愿得一人]
    2021-01-17 01:57

    If you're using all textboxes:

    for(c in document.getElementById('id_of_form').childNodes) {
        c.innerHTML = "";
    }
    

    If you're using multiple things, replace childNodes with getElementByTagName("name of tag") and filter with type.

提交回复
热议问题