Adding value to an Input field on click

Posted by Wazdesign on Stack Overflow See other posts from Stack Overflow or by Wazdesign
Published on 2010-04-08T11:11:07Z Indexed on 2010/04/08 11:23 UTC
Read the original article Hit count: 303

Filed under:
|
|
|
|

I have this structure on form,

<input type="test" value="" id="username" />

<span class="input-value">John Smith</span>

<a href="#" class="fill-input">Fill Input</a>

when user click on the Fill Input ,

the data from span which has class input-value will be added to value, after clicking a tag the code should be look like this,

 <input type="test" value="john Smith" id="username" />

    <span class="input-value">John Smith</span>

    <a href="#" class="fill-input">Fill Input</a>

there are many forms element/input on the single page.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery