How do I make a link that goes nowhere?

前端 未结 7 755
梦毁少年i
梦毁少年i 2021-02-01 11:50

Is it possible to make a link that does nothing?

I want the item to be a link so I get the cursor to change on mouseover, but I don\'t want the link to actually go anywhe

相关标签:
7条回答
  • 2021-02-01 12:55

    Instead, you could use a <span> and set the cursor style:

    <span id="node42" class="node-link">My Text</span>
    

    And specify the cursor in your stylesheet:

    .node-link { cursor: pointer; }
    

    This would also allow you to attach to the node for your actions later (show here using Prototype):

    <script type="text/javascript">
        $('node42').observe('click', function(event) {
          alert('my click handler');
        });
    </script>
    
    0 讨论(0)
提交回复
热议问题