This is a migrated thread and some comments may be shown as answers.

Multiple check box checked in check box checked in javascript

3 Answers 38 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 24 Aug 2012, 12:05 PM

when i click one check box multiple check box are checked true 
this is the way i check here but that all are not checked

                        document.getElementById('<%= Chk_Admins.ClientID %>').Checked = true;      
                        document.getElementById('<%= Chk_Technice.ClientID %>').Checked = true;      
                        document.getElementById('<%= Chk_requestor.ClientID %>').Checked = true;      
                        document.getElementById('<%= Chk_Req_Port.ClientID %>').Checked = true;      
                        document.getElementById('<%= Chk_Tech_Port.ClientID %>').Checked = true; 


Thanks Advance,
Mohamed.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Aug 2012, 12:35 PM
Hi,

Try accessing the checkbox as shown below.
JS:
document.getElementById("Chk_Admins").Checked = true;

Thanks,
Shinu.
0
mohamed
Top achievements
Rank 1
answered on 24 Aug 2012, 12:39 PM
Thanks for Your reply Shinu ,

Already i tried it error come like that
Microsoft JScript runtime error: Unable to set value of the property 'Checked': object is null or undefined

Thanks Advance,
Mohamed
0
mohamed
Top achievements
Rank 1
answered on 25 Aug 2012, 07:26 AM
Problem Resolved

var chkthp = document.getElementById('<%= Chk_Tech_Port.ClientID %>');
chkthp.checked = true;

Regards,
Mohamed.
Tags
General Discussions
Asked by
mohamed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
mohamed
Top achievements
Rank 1
Share this question
or