Home Download Buy Blog Forum Support

Invalid JQuery snippet

Invalid JQuery snippet

Postby emilnygaardfrisk on Sun Dec 02, 2012 6:55 pm

I have problems with one of my snippets, the snippet looks like this.
Code: Select all
<snippet>
   <content><![CDATA[

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

]]></content>
   <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
   <tabTrigger>divllink</tabTrigger>
   <!-- Optional: Set a scope to limit where the snippet will trigger -->
   <!-- <scope>source.python</scope> -->
</snippet>


My issue is that the snippet just doesn't show anything when i use it.
emilnygaardfrisk
 
Posts: 1
Joined: Sun Dec 02, 2012 6:51 pm

Re: Invalid JQuery snippet

Postby iamntz on Sun Dec 02, 2012 7:03 pm

You should escape all $ you have in your code:
Code: Select all
\$(".myBox").click(function(){
     window.location=\$(this).find("a").attr("href");
     return false;
});
iamntz
 
Posts: 914
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania


Return to Technical Support

Who is online

Users browsing this forum: Majestic-12 [Bot] and 18 guests