Adding an onclick function to go to url in JavaScript?

前端 未结 9 1275
北荒
北荒 2020-11-29 18:28

I am using this fancy little JavaScript to highlight a field as the user hovers over it. Could you please tell me if there is a way of adding an onclick functio

9条回答
  •  囚心锁ツ
    2020-11-29 19:00

    If you would like to open link in a new tab, you can:

    $("a#thing_to_click").on('click',function(){
        window.open('https://yoururl.com', '_blank');
    });
    

提交回复
热议问题