How to check radio button is checked using JQuery?

后端 未结 8 814
猫巷女王i
猫巷女王i 2020-12-24 07:20

I have two radio buttons in one group, I want to check the radio button is checked or not using JQuery, How ?

8条回答
  •  暖寄归人
    2020-12-24 07:33

    
    //the following code checks if your radio button having name like 'yourRadioName' 
    //is checked or not
    $(document).ready(function() {
      if($("input:radio[name='yourRadioName']").is(":checked")) {
          //its checked
      }
    });
    
    

提交回复
热议问题