0

I created a sublime snippet that spits out the jquery document ready function. When I start typing out the tab trigger in a javascript file, it appears in a popup, but when I hit enter or tab, no code appears. I tried restarting Sublime multiple times, but have had no success.

Here is my snippet code.

<snippet>
    <content><![CDATA[
$( document ).ready(function() {
    $1
});
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>jdocr</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.js</scope>
</snippet>

Any ideas as to what I am doing wrong?

1 Answer 1

6

Escape the jQuery's $ with a slash \

<content><![CDATA[
\$( document ).ready(function() {
    $1
});
]]></content>

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.