dalesingapore
New Member
I have a table where each row is clickable using \[code\] echo "<tr class=\"trlink\" onclick=\"location.href='".$row['task_id']."'\">\n";\[/code\]No issues there.I then have three links inside one cell in this row. The two that point to different pages work fine. There is one link however that toggles a modal dialog, it will not display with the onclick included in the tag. It works fine without. I use the following as an \[code\]<a role=\"button\" href=http://stackoverflow.com/"#" . $row['task_id'] . "taskModal\" data-toggle=\"modal\">\[/code\]Whenever the link is clicked, it goes straight to the href assigned to the .I assume the issue lies in event bubbling. I did some googling and found a small Javascript script to cancel the bubbling on click of the modal trigger:\[code\]function cancelIt(evt) {var e = (typeof evt != 'undefined') ? evt : event;e.cancelBubble = true;}\[/code\]And \[code\]<a href=http://stackoverflow.com/"...\" onclick=\"cancelIt(event);\" >\[/code\]on the modal trigger This solves the problem of loading the initial link when clicked, however the modal does not display either.Thanks for any assistance.