i have php loop prints anchor multiple times :
<div class="hidden-phone visible-desktop action-buttons"> <a class="red" href="#" id="d_id" data-value="<?php echo $row['id'];?>"> <i class="icon-trash bigger-130" id="bootbox-confirm"></i> </a> </div>
and have jquery code link has been clicked :
<script type="text/javascript"> $(function() { $("#d_id").on(ace.click_event, function() { var x = $(this).attr('data-value'); bootbox.confirm(x, function(result) { if(result) { bootbox.alert(x); } }); }); }) </script>
this work first anchor
any appreciated
change id's classes since id's ment unique , reason first element id taken account jquery:
<div class="hidden-phone visible-desktop action-buttons"> <a class="red d_id" href="#" data-value="<?php echo $row['id'];?>"> <i class="icon-trash bigger-130" id="bootbox-confirm"></i> </a> </div> <script type="text/javascript"> $(function() { $(".d_id").on(ace.click_event, function() { var x = $(this).attr('data-value'); bootbox.confirm(x, function(result) { if(result) { bootbox.alert(x); } }); }); }) </script>
Comments
Post a Comment