Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

How can I Make A PHP Form To Enter Data By The Help of 'Enter' Button

I want to make a PHP Form Where User Can Enter the Data By Pressing Enter Button with using JAVASCRIPT

1 Answer

Robert Walker
Robert Walker
17,146 Points

There are a number of ways to do this assuming I understand what you are trying to do correctly.

One using Jquery and the other pure JavaScript, personally I would use Jquery as it is likely you use Jquery again at some point through the project, if not just go the pure JavaScript route.

First thing to do would be to create a button with the value you wish to add (the text) and then on click have it insert the text into the form element.

https://api.jquery.com/click/

http://www.w3schools.com/jsref/event_onclick.asp