简体   繁体   中英

Using Dynamic Table Dropdown to Disable Radio Button

I just need some clarification with the JQuery/JavaScript syntax.

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.

Thanks in advance.

Can I see your html?

Why do you have multiple id's in the first place? 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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