I have my data show with arrays, but I have a problem when I want to click on one of the data that appear all the same, must be different, what is wrong with my script
<?php
foreach($data as $row){
?>
<a href="javascript:void(0)" class="set_module">
<div class="col-lg-4 col-xs-6">
<div class="post-module">
<div class="tmb">
<img src="<?php echo base_url();?>assets/file/image-module/<?php echo $row->image; ?>"/>
</div>
<input type="text" name="id_m[<?php echo $row->id_module;?>]" id="id_m" value="<?php echo $row->id_module;?>"></input>
</div>
</div>
</a>
<?php } ?>
This my jquery
$("a.set_module").on("click", function (event) {
event.preventDefault();
var value = $('#id_m').val();
alert(value);
return false;
});
the example above is I have data A, B, C and I show it by looping but when I click one of the data only data A keep appearing