Home Download Buy Blog Forum Support

Jquery user made snippets wont work

Jquery user made snippets wont work

Postby Creature on Wed Nov 14, 2012 5:02 pm

I have created a few different snippets but for some reason this one wont work. What am I missing? Any help would be great.

<snippet>
<content><![CDATA[
<script type="text/javascript" src="jquery-1.8.2.js"></script>
<script type="text/javascript">
$("document").ready(function(){
${1}
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>docready</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
Creature
 
Posts: 3
Joined: Wed Nov 14, 2012 4:57 pm

Re: Jquery user made snippets wont work

Postby C0D312 on Wed Nov 14, 2012 5:06 pm

you gotta escape your dollar signs \$.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Jquery user made snippets wont work

Postby Creature on Wed Nov 28, 2012 5:05 am

Still not working, put the \$ and has no effect.
Creature
 
Posts: 3
Joined: Wed Nov 14, 2012 4:57 pm

Re: Jquery user made snippets wont work

Postby iamntz on Wed Nov 28, 2012 5:23 am

Code: Select all
<snippet>
  <content><![CDATA[<script type="text/javascript" src="jquery-1.8.2.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(\$){
  $0
});
</script>
]]></content>
<tabTrigger>docready</tabTrigger>
<scope>text.html</scope>
</snippet>


This one works just fine.
Last edited by iamntz on Wed Nov 28, 2012 6:05 am, edited 1 time in total.
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Jquery user made snippets wont work

Postby Creature on Wed Nov 28, 2012 5:49 am

What is <scope>source.js</scope> for?
Creature
 
Posts: 3
Joined: Wed Nov 14, 2012 4:57 pm

Re: Jquery user made snippets wont work

Postby iamntz on Wed Nov 28, 2012 6:04 am

Well, to work on js files (which i just realized that is dumb). You may want to remove that line or replace it with text.html
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], movax, Yahoo [Bot] and 26 guests