【问题标题】:How can I convert this coffeescript to js/jquery? [closed]如何将此咖啡脚本转换为 js/jquery? [关闭]
【发布时间】:2013-09-03 12:30:46
【问题描述】:
text = child.html()
text = text.replace /(#include(\s*&lt;.*&gt;)?)/gi, '<span>$1</span>'
text = text.replace /(main\(.*\))/gi, '<span>$1</span>'
child.html text

http://jsfiddle.net/dcro/XKHC8/

这是我的问题的答案:Wrapping strings with a span我不知道如何使用咖啡脚本,并且回答的人看起来不可用。

【问题讨论】:

  • js2coffee.org 是一个翻译网站
  • 所有你需要做的就是在函数调用中添加括号(html和replace)
  • 语法错误缺少操作数..
  • @BarbaraLaird 该站点与此处需要的相反...
  • @Oleh - 有 2 个选项卡,你可以选择任何一种方式

标签: javascript jquery coffeescript


【解决方案1】:

来自js2coffee.org

var text;

text = text.replace(/(#include(\s*&lt;.*&gt;)?)/gi, '<span>$1</span>');

text = text.replace(/(main\(.*\))/gi, '<span>$1</span>');

child.html(text);

【讨论】:

    猜你喜欢
    • 2012-10-24
    • 1970-01-01
    • 2013-11-21
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-27
    相关资源
    最近更新 更多