I have a sample code :
<input type="text" name="color" id="color" value="" />
And jquery
$('#color').change(function(){ $('#color').addAttr('value', 'test'); });
When I change value in textbox is result value="" and error in firebug $("#color").addAttr is not a function
value=""
$("#color").addAttr is not a function
How to fix it ?
You are confused about removeAttr() and you think that addAttr() exists, that's wrong.
removeAttr()
addAttr()
The function you want is .attr() - nowadays .prop(), I believe.
.attr()
.prop()