Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show choice when click on input type text using JavaScript?

Tags:

javascript

How can I show the user's choice when they click on input type text using JavaScript?

I want to use onclick on input type text. When the user clicks, I want to show their choice.

I tried searching for a function to do that, but I did not find any.

Could you please advise me on how to do that?

Image:

Screenshot

*remark : Australia , United Kingdom and United States not from database.

like image 672
robert qewerutiyo Avatar asked Jun 09 '26 17:06

robert qewerutiyo


1 Answers

you can use below code if your browser supports html5

<html>
    <body>
    <label for="country_name">Country : </label><input id="country_name" name="country_name" type="text" list="country" />
    <datalist id="country">
       <option value="Australia">
       <option value="United Kingdom">
       <option value="United States">
       </datalist>
    </body>
    </html>
like image 137
Murli Avatar answered Jun 12 '26 07:06

Murli