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
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
HTML Pages with CSS and JavaScript
Question on HTML Option Object
Ray Yung
Greenhorn
Posts: 6
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
With HTML, I could have
<select name="myList"> <option value="val1" alt="myValueDescription">name1</option> ... </select>
How do I achieve this if I create this option using JavaScript?
The constructor with Option object only takes name and value as
arguments? How do I add "alt" to the Option object?
THanks,
Ray
Eric Pascarello
author
Posts: 15385
6
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You need to use the title attribute:
<form name="form1"> <select name="myList"> <option value="val1" title="myValueDescription">name1</option> <option value="val2" title="dsfdsfds">name2</option> </select> <script> var sel = document.form1.myList; sel.options[1].title = "WOHOOO It WORKS!" </script>
FYI: IE does not support it to the best my knowledge. I know Firfox does.
Eric
Ray Yung
Greenhorn
Posts: 6
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Eric,
Thanks again!
I ordered your book and can't wait to read it.
--Ray
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Toggle Links Upon Dropdown Menu Selection
how to change select menu dynamically in a JSP
Getting an Option object from Select Object using JavaScript
html-el:select embeded in js, what should I do to let it runing or not Unterminated String Constant
What is attribute value in my code?
More...