I need the user to confirm that he wants to end the current before opening the fancybox to create a new game.
I have both tried to stop onClick
event propagation:
How to stop event propagation with inline onclick attribute?
<a href="../Dialogs/CreateGameDialog.aspx" class="createGameLink showDialog" onclick=" if(!confirm('<%# Strings.LoggedIn_ComfirmStartNewGame %>')){ disabledEventPropagation(arguments[0]); return false;} return true;">
<script type="text/javascript">
function disabledEventPropagation(event) {
if (event.stopPropagation) {
event.stopPropagation();
}
else if (window.event) {
window.event.cancelBubble = true;
}
}
</script>
And tried to unbind/bind fancybox based on confirmation results: Unbinding Fancybox on thumbnail fade
<a href="../Dialogs/CreateGameDialog.aspx" class="createGameLink showDialog" onclick=" if(!confirm('<%# Strings.LoggedIn_ComfirmStartNewGame %>')){ $('.createGameLink.showDialog').unbind('click.fb'); return false;} else{ bindCreateGameDialog(); return true;}">
<script type="text/javascript">
$('.createGameLink.showDialog').setFancybox( { 'height': 400, 'width': 200 } );
</script>
setFancybox is a wrap of $.fn.fancybox
.
But none of the approaches worked.