Mike
Mike

Reputation: 3276

jQuery set input values does not show up

Inside the browser I see a value in the #worktime input element. e.g. 7,6 This value gets set before by jQuery $("#worktime").val("7,6");

But when I look with firebug into this line of code I see no value:

<input id="worktime" value="" readonly="">

But under the DOM section in firebug I see for this element a value of "7,6".

If I want to print the #worktime value with alert no value shows up.

Upvotes: 0

Views: 76

Answers (1)

Kevin B
Kevin B

Reputation: 95018

This is because there is a very large difference between the value property and the value attribute. The value attribute contains the default value of the input, while the value property contains the current value. The default value can also be found in the defaultValue property. changing the value does not change the value attribute or the defaultValue property.

Upvotes: 2

Related Questions