I have 2 array elements. I tried to bind change event to first element so that the select change even will influence second element. Example:
<select name="item1[]" id="item1[]">
<option value="0">...</option>
<option value="1">...</option>
<option value="3">...</option>
</select>
<select name="item2[]" id="item2[]">
<option value="0">...</option>
<option value="1">...</option>
<option value="3">...</option>
</select>
<select name="item1[]" id="item1[]">
<option value="0">...</option>
<option value="1">...</option>
<option value="3">...</option>
</select>
<select name="item2[]" id="item2[]">
<option value="0">...</option>
<option value="1">...</option>
<option value="3">...</option>
</select>
Accordingly there are more rows with item1 and item2 array element waiting for PHP process.
When item1 select will change then item2 will populate. but my following jquery function do not work even in item1 change event. I could not understand why bind function not working. I tried to use alert but not work.
<script>
$('#item1[]').each(function(index){
$(this).bind("change", function(){
another function call to populate item2
alert($(this).val()); // not working
});
});
</script>
Please help.
Regards.
item1[]? IDs have to be unique![]isn't valid...or really appropriate (IMO) for an ID (.e.g. your current issue with escaping), why not have the ID just beitem1?