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>