Simple way to clear the value of any input inside a div?

前端 未结 8 981
谎友^
谎友^ 2020-12-13 07:36

Is there a simple way to iterate over the child elements in an element, say a div, and if they are any sort of input (radio, select, text, hidden...) clear their v

8条回答
  •  伪装坚强ぢ
    2020-12-13 08:32

    Oh boy, this would be a one liner with jQuery:

    $(':input:not(:button)', div).val([])
    

    Without jQuery you've got to account for

    提交评论

提交回复
热议问题