如何为 jQuery 创建代码段?
How do I create a snippet for jQuery?
所以我想为以下内容创建一个片段:
$("input").click(function(event){
//code goes here
});
但是当我尝试在 sublime text 中创建代码片段时:
<snippet>
<content><![CDATA[
$("${1:Tag}").click(function(event)
{
${2:code goes here}
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sclick</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
显然两者的“$”之间存在某种冲突。
我通读了文档,但没有找到任何东西。
如何为此创建代码段?
使用\
转义$
:
<snippet>
<content><![CDATA[
$("${1:Tag}").click(function(event)
{
${2:code goes here}
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sclick</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
所以我想为以下内容创建一个片段:
$("input").click(function(event){
//code goes here
});
但是当我尝试在 sublime text 中创建代码片段时:
<snippet>
<content><![CDATA[
$("${1:Tag}").click(function(event)
{
${2:code goes here}
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sclick</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>
显然两者的“$”之间存在某种冲突。 我通读了文档,但没有找到任何东西。 如何为此创建代码段?
使用\
转义$
:
<snippet>
<content><![CDATA[
$("${1:Tag}").click(function(event)
{
${2:code goes here}
});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sclick</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.js</scope>
</snippet>