Sublime Forum

Invalid JQuery snippet

#1

I have problems with one of my snippets, the snippet looks like this.

[code]
<![CDATA[

$(".myBox").click(function(){
window.location=$(this).find(“a”).attr(“href”);
return false;
});

]]>

divllink



[/code]

My issue is that the snippet just doesn’t show anything when i use it.

0 Likes

#2

You should escape all $ you have in your code:

\$(".myBox").click(function(){
     window.location=\$(this).find("a").attr("href"); 
     return false;
});
0 Likes