Hello,
Sorta new with JavaScript... so don't kill me with jargon.
I am trying to make a script that will only allow text to be inputted into a textarea that is from a drop down menu. My problem is the textarea/textbox id is pre-set and unchangeable by the shopping cart system I use. (*Changing it will make it un-upgradeable in the future)
Here is what I have so far:
If you replace "attrib-1-0.value" with "foo" in both the script and the text field you will see a working version of the code. It's the invalid characters that mess it up. Now, I have tried to comment the invalid characters out with "/" but it didn't work.
Any suggestions?
Sorta new with JavaScript... so don't kill me with jargon.
I am trying to make a script that will only allow text to be inputted into a textarea that is from a drop down menu. My problem is the textarea/textbox id is pre-set and unchangeable by the shopping cart system I use. (*Changing it will make it un-upgradeable in the future)
Here is what I have so far:
Code:
<html>
<head>
<title>Dropdown to Textbox</title>
<script type="text/javascript">
function setName(child)
{
document.all.attrib-1-0.value = child.options[child.selectedIndex].text;
}
</script>
</head>
<body>
<select name="name" onchange="setName(this)">
<option value="001">AJ</option>
<option value="002">Andrew</option>
<option value="003">Andy</option>
</select>
<input type="text" name="id[txt_1]" size="32" maxlength="32" value="" id="attrib-1-0" />
</body>
</html>
Any suggestions?
Comment