preventDefault() won't work for me

后端 未结 2 737
星月不相逢
星月不相逢 2021-01-27 04:59

Why will this refuse to work?
HTML stuff


      
2条回答
  •  借酒劲吻你
    2021-01-27 05:27

    filter is the wrong method to use here. you should either use find to look for elements in a selection:

    $('div#nav-bar').find('a')...
    

    or simply combine that into one selector:

    $('div#nav-bar a')...
    

    after you've fixed that, your preventDefault will actually get applied and work, theres nothing wrong with that piece of code directly.

提交回复
热议问题