How can I disable all elements inside a fieldset in jQuery?

后端 未结 6 1880
夕颜
夕颜 2021-02-07 06:22

I have 2

s on my page, but one of them should have all of it elements disabled depending on some user\'s choice.

The fieldsets contain text

6条回答
  •  离开以前
    2021-02-07 06:54

    If for some reason you can't add an ID to the fieldset (which is usually preferred), you can always do this to hide all it's children elements:

    $('fieldset:first > *').attr('disabled','disabled');
    

提交回复
热议问题