I have a set of input fields on my page. They're setup as an array like so:
<input type="text" name="test[name][]" /><br />
<input type="text" name="test[name][]" /><br />
<input type="text" name="test[name][]" /><br />
<input type="text" name="test[name][]" />
What i need to do next it to set a unique value in each textfield. But i don't know how to iterate over these fields with jQuery. My attempt failed: DEMO
$(function() {
$.each('input[name="test[name][]"]', function() {
$(this).val('blaat');
});
});
Any idea how i can iterate over each input field, selecting them by name!? I don't have any influence on these controls. So i cannot give them an extra class name or anything like that. All i have are their names.