Here in this code, when I am displaying array in a form. I need to iterate over array, so that I can perform my code operation. My problem is jquery is only fetching first element. Can someone suggest what need to be done here, so that I can access all the elements.
<?php foreach($packs as $item) { ?>
<br/>
<label> Fee: </label>
<input type="text" id="price" name="price" value=<?php echo $item ?> />
<input type="text" id="discount" placeholder="discount" name="discount" value="10%" />
<br/>
<?php } ?>
jQuery(function($) {
$('#price').change(function() {
alert($(this).val());
});
});