Simulate native click

后端 未结 4 1914
灰色年华
灰色年华 2021-01-15 10:30

I need to trigger the click event on a link and then, if none of the listeners prevented the default, change the location.

This is what I\'ve got so far:

         


        
4条回答
  •  感情败类
    2021-01-15 11:00

    enter code hereTo extract my notes to others posts: (another way to say same basic stuff)

          MyLink 
            
    

    EDIT1:@ comments:

    If the "other" you describe returns false, you at that point, terminate the callback with the false - so you are correct but has nothing to do with this handler. Which ever one hits first executes, and the other never does return, and this one redirects prior to the other one hitting the log if it executes first.

    In order to put your log in, you put that where I have my

     "// do whatever I want here, then redirect"
    

    comment To remove the other event, then bind with this one only:

       MyLink 
            
    
                                     
                  
提交回复
热议问题