LoginSignup
4
4

More than 5 years have passed since last update.

aリンクを無効にする

Last updated at Posted at 2014-10-23

tab切替だったり、何らかの操作のトリガーにリンク(#)を使うことがあります。
ページをコーディングするときにリンクを使ったイベント処理はやるのですが、よく忘れるのが、処理のあとに記述するreturn falseですね。

いつも忘れて挙動がおかしいとかで突っ込まれるので、メモ投稿になります。

jQueryで無効

<a class="mod-tabBtn" href="#">LINK01</a>
$(function(){
    $('a.mod-tabBtn').click(function(){
        // なんらかの処理をする。。。
        return false;
    })
});

参考サイト

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4