:
$('select').each(
function(){
if( this.options[ this.selectedIndex ].getAttribute('selected') === null ){
alert( this.name +' has changed!')
}
});
:
, selectElement < select/ > elementYou ,
selectElement.selectedIndex
< option/ > , ,
selectElement.options[ selectElement.selectedIndex ]
Now that you know which selection element is selected, you can find out if this element has the selected = 'selected' attribute (as in the source code, it does not change - this is not the same as the. DOM node, which is true for the currently selected option item and changes when the selection changes)
pawel source
share