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!

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
237 views