View Single Post
Old 12-05-2009, 05:29 PM   PM User | #1
johnnnn
New Coder

 
Join Date: May 2009
Location: Pennsylvania, United States
Posts: 54
Thanks: 16
Thanked 0 Times in 0 Posts
johnnnn is an unknown quantity at this point
Exclamation Update value of hidden input element on textarea onChange?

I have an idea for a little script.....I'm just stuck on one little part: When a user changes the value in a input or textarea box, I want it to change the value of a certain hidden input tag too.

Here's what I have so far:

function getNewValue(inputhidden, textinput) {
var data = document.getElementById(inputhidden);
var text = document.getElementById(textinput);
data.value = text.value;
}

<input type= "text" name= "name" id= "name" onChange="getNewValue('detail', 'name')">
<input type= "hidden" name= "detail" id="detail" value= "">

However, this is not working and I'm not sure why
johnnnn is offline   Reply With Quote