jquery和javascript判断checkbox,radio是否选中

 时间:2026-04-24 10:37:26

1、jquery:

     (方法一):

     if($("#checkbox").is(":checked")){

              alert("checkbox被选中");

     }else{

              alert("checkbox取消选中");

     }

     (方法二):    

     if($("#checkbox").attr('checked')){

              alert("checkbox被选中");

     }else{

              alert("checkbox取消选中");

     }

2、javascript:

    (方法一):

    if(document.getElementById("checkbox").checked){

         alert("checkbox被选中");

    }else{

         alert("checkbox取消选中");

    }

    (方法二):

    if(document.getElementById("checkbox").checked==true){

         alert("checkbox被选中");

    }else{

         alert("checkbox取消选中");

    }

jquery和javascript判断checkbox,radio是否选中

jquery和javascript判断checkbox,radio是否选中

  • jq判断checkbox是否选中
  • 如何利用jquery方法判断checkbox复选框是否选中
  • 使用jquery判断及改变checkbox选中状态
  • jquery checkbox 如何设置选中
  • jQuery多级复选框checkbox选中
  • 热门搜索
    北戴河旅游网 公司旅游注意事项 绵阳旅游网 国外旅游的好地方 郑州旅游地图 昌平旅游景点 淮安旅游团 比较好的旅游网站 南岳衡山旅游网 湖北在线旅游网