Here i am describing how you get the value from the check box list using javscript
JavaScript
----------
function getName1()
{
var chkText = '';
var chktable = document.getElementById('chklistInterests');
var chktr = chktable.getElementsByTagName('tr');
for(var i=0; i
{
var chktd = chktr[i].getElementsByTagName('td');
for(var j=0; j
var chkinput = chktd[j].getElementsByTagName('input');
var chklabel= chktd[j].getElementsByTagName('label');
for(k=0;k ;lt chkinput.length;k++)
{
var chkopt = chkinput[k];
if(chkopt.checked)
{
chkText = chkText + chklabel[k].innerText + ',';
}
}
}
}
alert( chkText);
}
3 comments:
hi vipul,
Thanks for above code.
but this code works only for IE and doesnt work for Firefox. Update this if u have any idea ..
use innerHTML instead of innerText, it will works for you.
try this one http://www.webdevelopersnotes.com/tips/html/finding_the_value_of_a_checkbox.php3
Post a Comment