Jump to content

Recommended Posts

I want to add a feature to my site, but I have no idea what it is called. So I cannot even google it.

 

What I want is when a user clicks on a certain textfield, I want to populate a menu under the textfield with different things. If the user clicks on one of the options, I want the value of that option to be inserted into the textfield, or if the user do not want any of the options, they can enter type in what they want.

 

Any Ideas?

Link to comment
https://forums.phpfreaks.com/topic/120565-solved-what-is-this-called/
Share on other sites

this is called "custom javascript."  you'll need to use javascript events to handle when users select something and deselect them, as well as how to add things to the element properties.  have a look for the following events:

 

onfocus (selection)

onblur (deselection)

 

you may also want to look up how to select and modify certain properties of certain elements.  that's basic javascript, and any beginner tutorial to do with forms should be able to help you.

You want to look into how to manipulate the DOM (document object model) using javascript.

 

If the info you want to be placed in the text field has to come from the database, you want to look into AJAX, which is a method of using javascript to make requests to the server, and then use the response information to change the page it is running on.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.