I have something like that:
<input id="zip_code" type="text" value="" data-existing-value="09458" name="zip_code"/>
I am trying to get an existing zip code value from data parameter using:
$("#zip_code).val($('#zip_code').data('existing-value'));
And for some reason zero is removed…and all i am getting for the text field value is : “9458” without a leading zero…
How can i keep zero?
Try .attr() instead of .data()