0

I am a bit puzzled by this behaviour.

I clone a table with jquery, then do a GET request to the server and get a json. From that I set the value for each field in the cloned table.

enter image description here

It all appears just fine on the screen, however I don't see any value in FireBug for that element.

<input id="id_deals-1-deal_template_name" type="text" maxlength="100" name="deals-1-deal_template_name" readonly="True">

The way I set the value is like this, maybe I do this wrong:

$('#id_deals-' + (total-1) + '-deal_template_name').val(template_name);
1
  • You're doing it right. A firebug refresh doesn't show you the attribute?
    – Asciiom
    Commented Sep 25, 2012 at 10:36

1 Answer 1

2

The value attribute sets the default value.

The value property, which is set by the jQuery val(), method deals with the current value.

You shouldn't see a change in the attribute when viewing in Firebug as you aren't changing the default value.

If you really want to change that then use .attr('value', foo) instead.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.