Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Creating a checked Checkbox through javascript.

800409May 19 2005 — edited Jan 19 2006
I'm creating a table on the fly.. everything is working fine except the checkbox should be checked.
var cellThird = row.insertCell(2);
var el = document.createElement('input');
el.setAttribute('type', 'checkbox');
el.setAttribute('name','e_tmpl_vis');
if(selectedTmpl.value=="true"){
	alert("true");  //This is creating an alert at the correct time.
	el.setAttribute('value', 'on'); // I've tried both of these, neither seem to work.
	el.setAttribute('checked','true');
	
}else{
	el.setAttribute('value', 'off');
}
//el.onclick=function() {toggleArrayCheckBoxValue(this)}
cellThi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2006
Added on May 19 2005
14 comments
195 views