I have the following input without any form around it:
alert($$('[name="td_website static"]')[0].value)
That because $()
function is an alias for getElementById()
. Which means you need to give and id in your input :)
<input type="text" value="myValue" id="td_website static" name="td_website static" class="td_inner_input">
You need to use the $$ function which returns an array. There are a couple of ways to use an enumerable result.
If you know there will be only one matching element then use this:
$$('[name="tb_website static"]').first().value
If there are more than one input (which is valid HTML) then this gets an array of values:
$$('[name="tb_website static"]').map(Form.Element.getValue)
(By mapping through Form.Element.getValue - aliased as $F - it better handles browser differences and non-input
elements that don't store their value in a value
attribute)
I'm pretty sure that $('tb_website static')
will be looking for an element with that ID not that NAME.
Have another look at the PrototypeJS Documentation.