how to use the $ char in sublimetext snippets?

64 views Asked by At

Does any of you know how to use $ char inside a sublimetext snippet? It conflicts with the placeholder syntax.

But what about all that js/jquery stuff like $(document).ready?

$(document).ready(function(){
  ${1}
});

You can clearly see the problem here.. I can't find a solution on docs

2

There are 2 answers

1
DannyFeliz On BEST ANSWER

You can escape special characters like $ with the backslash key \.

Example:

\$(document).ready(function(){ 
  ${1} 
});

Result:

$(document).ready(function(){
  ${1}
});
0
Janis Vepris On

Escape the dollar sign with a \

It should look like this:

\$(document).ready(function() {
    ${1}
})