Home › Forums › CSS › Javascript – Assign attribute › Re: Javascript – Assign attribute
January 7, 2011 at 2:14 pm
#67207
noahgelman
Participant
You shouldn’t have to set a variable if you don’t want to. Depending on what you’re using it for, it probably is a better idea to. But just in case, here it is on one line.
document.getElementsById('planSelectionDiv ').getElementsByTagName('select').setAttribute("size", "2");
////////
Edit: Sorry, bad advice. After trying it out, apparently you can’t just chain them together like that. You have to use a variable like TT_Mark suggested.