复选框VAL没有显示假 [英] checkbox val not showing false

查看:111
本文介绍了复选框VAL没有显示假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我都有以下code:

 $("input:checkbox").live('click', function() {
                          alert($(this).val());
});

True如果复选框被选中所示。但是,如果复选框被选中,我取消了,显示的值仍然是正确的。我该如何纠正?什么是错的code?谢谢

True is shown if the checkbox is checked. However, if the checkbox is checked and I uncheck it, the value shown is still true. How can I correct that? What is wrong with the code? Thanks

推荐答案

复选框的价值是永远不变的。你需要看它是否被选中与否。

The value of a checkbox is always the same. You need to see if it is checked or not.

….attr('checked');

这篇关于复选框VAL没有显示假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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