I have a small issue:
I have a jquery onclick event set for a row() in a table and in the last column I have a link that opens a confirmation pop-up(asking if I am sure to do that bla bla . . .). If I click the link, the pop-up opens, and if I press no, it should stay on the current page, but instead it continues with the event from the row(that click is triggered). What do you think?
Link:
<tr class="clickableRow" id="someId"> bgcolor="color">
..........
<td>
<a href="javascript:void(0)" onClick="javascript:del_prompt('url');"> <img src="images/delete.png" border="0"></a>
</td>
</tr>
Javascript:
$(".clickableRow").click(function() {
window.open("companynewestimate.php?id="+this.id,"_parent");
});
Del function
<script language="javascript">
function del_prompt(id)
{
if(confirm ("Are you sure you want to delete selected Record")){
location.href = "companyopenestimates.php?act=del&id="+id;
}
else{
return false;
}
}
</script>
Without some code, it's hard to get the correct answer. But maybe this helps:
$("#element").on("click",function(e){
//do something
e.preventDefault();
e.stopPropagation();
})
Changing your link's onclick
should do the trick:
onClick="del_prompt('<?=$line['id_est']?>'); return false;"
Note that the javascript:
is not at all needed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.