preventDefault:イベントのキャンセル
$("a").click(function(ev) { if( !confirm("画面遷移しますか?") ) ev.preventDefault(); // return false; でも、同じような挙動を得られるが // 別のイベントもキャンセルされる場合があるので、なるべくpreventDefaultを使用 });
$("a").click(function(ev) { if( !confirm("画面遷移しますか?") ) ev.preventDefault(); // return false; でも、同じような挙動を得られるが // 別のイベントもキャンセルされる場合があるので、なるべくpreventDefaultを使用 });