Subscribe Now!

Enter your email address:

Tuesday, January 18, 2011

Get CheckBox Text and Checked property using Javascript


function checkboxClick(obj) 
{ 
    var lbl = obj.nextSibling; 
    while(lbl.nodeName.toLowerCase()!='label')  
        lbl=lbl.nextSibling; 
  
    alert(lbl.innerHTML); 
     
    if (obj.checked) 
        alert('checked'); 
    else 
        alert('not checked'); 
} 
  
  
  
  
<asp:CheckBox ID="chk" runat="server" Text="Check" 
onclick="checkboxClick(this);" />

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...