如何检查点击复选框是否使用jQuery [英] how chek on click check box is checked or not using jQuery

查看:61
本文介绍了如何检查点击复选框是否使用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery(document).ready(function ($) {
            $('.chk').change(function () {
                if ($(this).prop('checked')) {
                    //Do stuff
                    alert('0');
                    var selectitem = parseInt($(this).closest('.accordion-group').find('.selectitem').text());
                    if (selectitem != 0) {
                        $(this).closest('.accordion-group').find('.selectitem').text(selectitem - 1);
                    }
                    else {
                        $(this).closest('.accordion-group').find('.select').show();
                    }
                }
                else {
                    var selectitem = parseInt($(this).closest('.accordion-group').find('.selectitem').text());
                    $(this).closest('.accordion-group').find('.selectitem').text(selectitem + 1);
                    $(this).closest('.accordion-group').find('.select').show();

                }
            });
        });

推荐答案

){


' 。chk')。change(function(){
if
('.chk').change(function () { if (


this )。prop('' 选中')){
// 做事
alert(' 0');
< span class =code-keyword> var selectitem = parseInt(
(this).prop('checked')) { //Do stuff alert('0'); var selectitem = parseInt(


这篇关于如何检查点击复选框是否使用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆