Clicking anchor should execute javascript not go to new page

前端 未结 5 796
忘掉有多难
忘掉有多难 2021-01-14 07:45

I have a HTML anchor that when clicked should make a div slide up or down (I call JQuery\'s .slideToggle(); function);

My Problem: When

5条回答
  •  不要未来只要你来
    2021-01-14 08:15

    An A element with an href is a link, not an anchor (anchors are A elements with name attribute and are the target of links).

    Since the element isn't being used either as a link or target, you shouldn't be using an A element at all, use a button or styled span. Then you don't need to worry about the default behaviour of a link.

    
    

    or

    Attach File
    

提交回复
热议问题