# onClick copies text from one field to another

**URL:** <https://forum.kirupa.com/t/onclick-copies-text-from-one-field-to-another/260556>\
**Category:** web dev\
**Created:** [May 16, 2008, 5:54pm UTC](https://forum.kirupa.com/t/onclick-copies-text-from-one-field-to-another/260556 "2008-05-16T17:54:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)\
**Post date:** [May 16, 2008, 5:54pm UTC](https://forum.kirupa.com/t/onclick-copies-text-from-one-field-to-another/260556/1 "2008-05-16T17:54:37Z")

</div>

I’ve searched through google and have found things similar, but nothing for what I need. Most of the tut’s were far more advanced than what I needed.

So, anyone know some JS that will copy text from textfield1 to textfield2?

Thanks!

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [May 16, 2008, 7:00pm UTC](https://forum.kirupa.com/t/onclick-copies-text-from-one-field-to-another/260556/2 "2008-05-16T19:00:45Z")

</div>

[quote=Syous;2327238]I’ve searched through google and have found things similar, but nothing for what I need. Most of the tut’s were far more advanced than what I needed.

So, anyone know some JS that will copy text from textfield1 to textfield2?

Thanks![/quote]

I’m a bit of a framework guy, here’s the mootools answer:

```auto

$('textfield2').setProperty('value',$('textfield1').getValue());

```
