Link to home
Start Free TrialLog in
Avatar of sahanz
sahanz

asked on

Copy what user types in a text filed in to a hidden field

In my page I have a text field <input type="text" name="txt" /> So what I want is, I want to add what user types in this filed in to a hidden field realtime, Would be gr8 if can be done using jquery
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sahanz
sahanz

ASKER

actually hidden value is in a different form
jQuery - something like :
<form>
<input type="hidden" name="htext" id="htext" value="" />
</form>
<form>
<input  type="text" name="txt" id="txt"/>
</form>
$("#txt").bind("keyup", function() {
  $("#htxt").val($(this).val())
});


Other form, no jQuery:



<form>
<input type="hidden" name="htext" value=""  />
</form>

<form>
<input type="text" name="txt" onKeyUp="document.forms[0].htext.value=this.value"  />
</form>

[0] denotes the FIRST (0th) form
Avatar of sahanz

ASKER

Thanks