1

When I am trying to use, the dollar signs are preventing the code snippet to work properly...

$('.modal').on('hide.bs.modal', function(e) {    
    var $if = $(e.delegateTarget).find('iframe');
    var src = $if.attr("src");
    $if.attr("src", '/empty.html');
    $if.attr("src", src);
});

1 Answer 1

1

You need to escape the Dollar Sign ($) with Back Slash (\) while creating the new snippet with sublime text. Your snippet content should be as : <content>

<snippet>
    <content><![CDATA[
\$('.modal').on('hide.bs.modal', function(e) {    
    var \$if = \$(e.delegateTarget).find('iframe');
    var src = \$if.attr("src");
    \$if.attr("src", '/empty.html');
    \$if.attr("src", src);
});
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>myscript</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.python</scope> -->
</snippet>
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.