Why jQuery trigger or triggerHandler doesn't work?
问题 Here is my code : <html> <head> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script type='text/javascript'> window.onload=function(){ var e = jQuery.Event( "click" ); e.preventDefault(); $("#rrx").triggerHandler(e); $("#rrx").trigger("click"); } </script> </head> <body> <a href="http://google.com" id="rrx" > gooooooog </a> </body> </html> After page load I should be redirected to http://google.com but this is not happening! 回答1: You need to call native click method on anchor