Jquery - attribute or property (attr vs prop)
С версии 1.6.1 в JQuery изменилось обращение к атрибутам (attr)
http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/
Если после обновления JQuery перестали работать атрибуты selected/defaultValue/selectedIndex (или вообще не работает JQuery как ожидается) - рекомендую ознакомиться с табличкой атрибутов/свойств JQuery
Attribute/Property | .attr() |
.prop() |
---|---|---|
accesskey | ✓ | |
align | ✓ | |
async | ✓ | ✓ |
autofocus | ✓ | ✓ |
checked | ✓ | ✓ |
class | ✓ | |
contenteditable | ✓ | |
defaultValue | ✓ | |
draggable | ✓ | |
href | ✓ | |
id | ✓ | |
label | ✓ | |
location * | ✓ | ✓ |
multiple | ✓ | ✓ |
nodeName | ✓ | |
nodeType | ✓ | |
readOnly | ✓ | ✓ |
rel | ✓ | |
selected | ✓ | ✓ |
selectedIndex | ✓ | |
src | ✓ | |
style | ✓ | |
tabindex | ✓ | |
tagName | ✓ | |
title | ✓ | |
type | ✓ | |
width ** | ✓ |
* For example, with window.location
** If needed over .width()
Метки: JQuery