Check first radio button with JQuery

前端 未结 7 1356
春和景丽
春和景丽 2021-01-03 20:22

I would like to check the first radio button of each group. But there are some radio button that are disabled, so the script should ignore them and go to next non-disabled b

7条回答
  •  猫巷女王i
    2021-01-03 20:46

    The below does what you want:

    $(document).ready(
      function(){
        $('input:radio:first-child').attr('checked',true);
      }
      );
    

    Demo at: JS Bin.

提交回复
热议问题