You can get it using the :selected
selector, like this:
$("#my_select").change(function() {
var id = $(this).children(":selected").attr("id");
});
More Related Contents:
- jQuery: select an element’s class and id at the same time?
- jQuery selectors with variables
- What is fastest children() or find() in jQuery?
- jQuery Selector: Id Ends With?
- jQuery OR Selector?
- jQuery selector value escaping
- Sort divs in jQuery based on attribute ‘data-sort’?
- jquery find versus context selection
- How to select last child element in jQuery?
- jQuery DOM changes not appearing in view source
- CSS selector case insensitive for attributes
- jQuery get all divs which do not have class attribute
- Is it possible to use jQuery to read meta tags
- What CSS3 selectors does jQuery really support, e.g. :nth-last-child()?
- Difference between :hidden and :not(:visible) in jQuery
- Count immediate child div elements using jQuery
- How can I get the corresponding table header (th) from a table cell (td)?
- Select elements without any class [duplicate]
- jQuery attribute selector for multiple values
- jQuery: selector (classname with space)
- Find all elements based on ids using regex on jQuery selector
- JQuery data selector not updating with .data
- :nth-of-type() in jQuery / Sizzle?
- How to select specific form element in jQuery?
- How to get form html() via jQuery including updated value attributes?
- Using jQuery how do I select a range of rows?
- Jquery find all ids starting with a string?
- jQuery: using a variable as a selector [duplicate]
- How to use placeholder as default value in select2 framework
- How do I select an element with special characters in the ID?