The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Javascript – Assign attribute Re: Javascript – Assign attribute


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.