My div is not redirecting using jQuery

后端 未结 2 471
余生分开走
余生分开走 2021-01-16 22:23

Using jQuery from here: http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js

$(\".myBox\").click(function(){
    window.location=$(this).attr(\"h         


        
2条回答
  •  一整个雨季
    2021-01-16 22:27

    What TurnItUp posted above should work as well but here you go, the JQuery approach:

    $(".mybox").click(function(){
        $(location).attr('href','http://www.google.com');
    });
    

    I also assume that you're wrapping it under "document ready event", correct ?

    Full thing should really be

    $(function()
    {
       $(".mybox").click(function(){
           $(location).attr('href','http://www.google.com');
       });
    });
    

提交回复
热议问题