Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
Set default value for datalist
Vineeth Vasudevan
Greenhorn
Posts: 21
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
How do you set a default value for a datalist element?
Greg Charles
Sheriff
Posts: 3063
12
I like...
posted 8 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't think you can. You can assign of value attribute to the input control, and that might give you approximately what you want. Something like:
<input list="cities" name="city" value="San Diego"> <datalist id="cities"> <option value="San Diego"> <option value="Del Mar"> <option value="Solana Beach"> <option value="Escondido"> <option value="Carlsbad"> </datalist>
You could probably spruce it up with a little JavaScript/jQuery to fine tune the behavior.
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Converting excel to XML,Reading And Writing
How to create a h:selectOneMenu with a default value?
richfaces :comboBox defaultLabel, required=false question
Assigning a Class with Multiple Parameters
how to keep register page data if register fails
More...