当我尝试使用时,美元符号阻止代码段正常工作......
$('.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);
});
答案 0 :(得分:1)
您需要使用Back Slash($
)转义美元符号(\
),同时创建带有sublime文本的新代码段。您的代码段内容应为:<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>