Search code examples
javascriptjquerysublimetext3code-snippets

how to use the $ char in sublimetext snippets?


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


Solution

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

    Example:

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

    Result:

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