HTML
HTML Basic
HTML Tags
HTML Formatting
HTML Attributes
HTML & Styles
HTML & Scripts
HTML Tables
HTML Lists
HTML Links
HTML Forms
HTML Images
HTML Meta Tags
HTML Layout
HTML Doctypes
HTML CSS
HTML Head
HTML Scripts
HTML Entities
HTML Encoding
HTML5
HTML5 Basic
HTML5 Tags
HTML5 Input Types
HTML5 Video
HTML5 Audio
HTML5 Drag and Drop
HTML5 Canvas
HTML5 SVG
HTML5 Geolocation
CSS
CSS Basic
Applying CSS
CSS Selectors
CSS Colors
CSS Text & Fonts
CSS Borders
CSS Align
CSS Margins & Padding
CSS Grouping & Nesting
CSS Positioning
CSS Floating
CSS Dimension
CSS Display
CSS Pseudo
CSS3
CSS3 Basic
CSS3 Selectors
CSS3 Shadows
CSS3 Gradients
CSS3 Transitions
CSS3 Animations
CSS3 @Font Face
CSS3 Rounded Corners
CSS3 Multi Columns
CSS3 Flexible Box
CSS3 Transform
JavaScript
JS Basic
JS Keywords
JS Statements
JS Variables
JS Operators
JS Functions
JS Objects
JS Guidelines
JS Comparisons
JS If...Else
JS Switch
JS Loop
JS Events
JS Try...Catch
JS Browser Objects
JS Cookies
JS Validation
JS Timer
JS Objects
jQuery
jQuery Core
jQuery Selectors
jQuery Attributes
jQuery Traversing
jQuery Manipulation
jQuery Events
jQuery CSS
jQuery Effects
jQuery Ajax
jQuery Plugins
jQuery Animations
jQuery Utilities
References
HTML References
HTML 5 References
CSS References
CSS3 References
JavaScript References
HTML Code References
Ascii Code References
URL Encode & URL Decode
HTML Encode & HTML Decode
HTML to Text
Home
Javascript
Option
option (JavaScript 1.0)
Option in a Select list.
Properties & Events
Key
Description
Availability
defaultselected
Whether or not the option is selected by default.
1.0
1.0
1.0
3.0
7.0
index
Index in the options array for the option.
1.0
1.0
1.0
3.0
7.0
selected
Whether or not the option is currently selected.
1.0
1.0
1.0
3.0
7.0
text
Text for the option.
1.0
1.0
1.0
3.0
7.0
value
Value of the option that is sent when the form is submitted.
1.0
1.0
1.0
3.0
7.0
Result from the Online TryIt-Editor
<!doctype html> <html> <head> <title>HtmlNest.com live html example</title> <script type="text/javascript"> function getResult() { var x = document.getElementById("mycountry").selectedIndex; var y = document.getElementById("mycountry").options; alert("Index: " + y[x].index + " is " + y[x].text); } </script> </head> <body> <form /> Select your city: <select id="mycountry"> <option />Oslo <option />New York <option />Bejing <option />London </select> </form> <button type="button" onclick="getResult()"> Find city index</button> </body> </html>
1.0
1.0
1.0
4.0
5.0
Examples having uses of: 'option'
Newest examples
Most popular examples
Most views examples
4 votes
11k views
HTML5 Datalist
Think of a combination of an input text element and selection list. Typically used where there is the likelihood of a visitor entering a value of other (not one of the items in the list).
2 votes
1k views
HTML Select
This HTML element defines a selection list within a form.
1 votes
2k views
Html Input Form
Example form using <legend> and <fieldset> to make the form layout fancy.
1 votes
2k views
jQuery Focus & Change Event
jQuery events can be used to register behaviors to take effect when the user interacts with the browser, and to further manipulate those registered behaviors.
0 votes
2k views
jQuery - Multiple CSS properties
jQuery allows to change the multiple CSS properties value at once.
Useful Information
Contact
Privacy Policy
Copyright 2014 htmlnest.com.
All Rights Reserved.