Adding an onclick function to go to url in JavaScript?

前端 未结 9 1274
北荒
北荒 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 18:54

    Not completely sure I understand the question, but do you mean something like this?

    $('#something').click(function() { 
        document.location = 'http://somewhere.com/';
    } );
    

提交回复
热议问题