Prior to jQuery 1.9, $().attr("value")
retrieved the value property instead of
the value attribute (which generally reflects the value that was read from HTML
markup). $().attr( "value", val )
set the value property instead of the value
attribute. This caused inconsistent behavior with selectors referencing the
value attribute.
Use
Examples of incorrect code for this rule:
var value = $('input.foo').attr('value')
$('input.foo').attr('value', 'newValue')
Examples of correct code for this rule:
var value = $('input.foo').val()
$('input.foo').val('newValue')
var value2 = $('div.bar').prop('value')
$('div.bar').prop('value', 'newValue')