复选框在javascript核对清单中同时检查并取消选中 [英] checkbox check and uncheck at the same time in checklist in javascript

查看:71
本文介绍了复选框在javascript核对清单中同时检查并取消选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:CheckBoxList ID="chkFlow" runat="server" onchange="fnchkFlow(this);">
                    <asp:ListItem Value="1" Text="Flow"></asp:ListItem>
                    <asp:ListItem Value="2" Text="STAT"></asp:ListItem>
                </asp:CheckBoxList>





i想要检查一个nd同时取消选中listitem及其文字或价值



怎么做。



请帮助

谢谢





编辑:AL。



如果选中'flow',则启用'Stat'。如果未选中'flow',则必须取消选中'stat'并禁用



i want to check and uncheck the listitem at the same time with their text or value

how to do it.

Please help
Thanks


AL.

If 'flow' is checked then 'Stat' is enabled. If 'flow' is unchecked, then 'stat' must be unchecked and disabled

推荐答案

此解决方案使用jQuery。如果你不使用jQuery,我建议你加入它。



This solution uses jQuery. If you don't use jQuery, I suggest you include it.

function fnchkFlow(this){
 
  //first get the jQuery version of the listbox
  var listbox =


this );

// 确保我们有一些东西(基本错误检查)
if (listbox&& listbox.length)
{
// 找到您正在查看的项目
// var optionFlow =
(this); //make sure we have something (basic error checking) if(listbox && listbox.length) { //find the items you're looking at //var optionFlow =


(listbox).find(option [value ='1']);
// var optionStat =
(listbox).find("option[value='1']); //var optionStat =


这篇关于复选框在javascript核对清单中同时检查并取消选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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