How do i cycle through all form inputs with a certain name and set those to a specified value?
I tried this jsfiddle and i can’t get it to work. http://jsfiddle.net/qvcA6/
$(document).ready(function() {
$("#link-1").click(function() {
$('[name=price]','#myform').val('0.00');
});
});
EDIT: i didn’t think it would matter, but the array key for the form field name isn’t accounted for. So all of your examples are working but they break when i put keys in the field names. Anybody know how to go about accounting for the keys? updated jsfiddle -> http://jsfiddle.net/qvcA6/8/
Updated the jfiddle for you http://jsfiddle.net/qvcA6/1/
There were two issues.
1) The attribute value needs to be surrounded by quotes.
2) The name of your inputs were ‘price[]’ and not ‘price’ so the jquery selector didn’t match anything