简体   繁体   English

使用动态表下拉菜单禁用单选按钮

[英]Using Dynamic Table Dropdown to Disable Radio Button

I just need some clarification with the JQuery/JavaScript syntax. 我只需要对JQuery / JavaScript语法进行一些说明。

for (var i=0;i<tableb.rows.length;i++){
    var roway = tableb.rows[i];
    if($(roway).find("input[id='location']")=='rr'){
        alert("eeee");
       }
   }

The above isn't working, and I'm not too certain how to specify when the "rr" value is selected in the dropdown with the location id. 上面的方法不起作用,我不太确定如何指定何时在具有位置ID的下拉列表中选择“ rr”值。

Thanks in advance. 提前致谢。

Can I see your html? 我可以看到您的HTML吗?

Why do you have multiple id's in the first place? 为什么首先要有多个ID? Anyways 无论如何

for (var i=0;i<tableb.rows.length;i++){
    var roway = tableb.rows[i];
    if($(roway).find("input#location").val()=='rr'){
        alert("eeee");
       }
   }

In case you have only 1 input with that ID then a cleaner way is 如果您只有1个具有该ID的输入,那么一种更简洁的方法是

if($("input#location") && ("input#location").val() == 'rr') {
    alert('eeee');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM