get controls using name
-
Hi, I have Two tables in my page Table 1 having list for checkbox with name CHK1 Table 2 also having list of checkbox with same name CHK1 using javascript i want to get the checkboxs form table 1.
You can get with providing id of table like your first table id is table1 Now you can get the check box inside the table1
//this will return all the inputs inside the table1
var ele = document.getElementById('table1').getElementByTagName('input')
//you can filter out it using type
for(var c=0;c < ele.length; c++){
if(ele[c].type=='checkbox'){
//do the code....
}
}Please do let me know, if you have any doubt. Please provide "Vote":thumbsup: if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose: Thanks, Imdadhusen
sunaSaRa Imdadhusen +91 99095 44184 +91 02767 284464
modified on Thursday, October 28, 2010 9:16 AM
-
Hi, I have Two tables in my page Table 1 having list for checkbox with name CHK1 Table 2 also having list of checkbox with same name CHK1 using javascript i want to get the checkboxs form table 1.
I think you'd better change one list checkbox name. if not, you can do it like the above answer, but it's not very good, i improve it at below:
//get all the checkbox of table 1
var ele = document.getElementById("table1").getElementsByTagName("input");
var size = ele.length;
var boxs = [];
var j=0;
for(var i=0;i
do you like more js or web skills? just click my blog! moocr.com :) -
Hi, I have Two tables in my page Table 1 having list for checkbox with name CHK1 Table 2 also having list of checkbox with same name CHK1 using javascript i want to get the checkboxs form table 1.
you can use '#table1 input:[name = CHK1]' as your parameter, and it will search get the checkbox of first table only..