Radio buttons not checked in jQuery

前端 未结 7 705
盖世英雄少女心
盖世英雄少女心 2020-12-23 08:51

I have this line of code for page load:

if ($(\"input\").is(\':checked\')) {

and it works fine when the radio button input is checked. How

7条回答
  •  自闭症患者
    2020-12-23 09:52

    if ( ! $("input").is(':checked') )
    

    Doesn't work?

    You might also try iterating over the elements like so:

    var iz_checked = true;
    $('input').each(function(){
       iz_checked = iz_checked && $(this).is(':checked');
    });
    if ( ! iz_checked )
    

提交回复
热议问题