Jquery 使用内联js替换当前标记中的文本

Jquery 使用内联js替换当前标记中的文本,jquery,Jquery,是否可以使用jquery替换当前标记中的字符串,如下所示: <td class="price"><script>$(this).text(accounting.formatMoney(parseFloat({{ product.price }}).toFixed(2), "€ ", 2, ".", ","));</script></td> $(this).text(accounting.formatMoney(parseFloat({{produ

是否可以使用jquery替换当前标记中的字符串,如下所示:

<td class="price"><script>$(this).text(accounting.formatMoney(parseFloat({{ product.price }}).toFixed(2), "€ ", 2, ".", ","));</script></td>
$(this).text(accounting.formatMoney(parseFloat({{product.price}}).toFixed(2),“€”,2,“,”,“,”));
实际上这不起作用


提前谢谢

您可以在函数中设置它,但在页面加载之后。。。像这样的东西是你要找的。。。首先,更改您的HTML:

<td class="price">{{ product.price }}</td>
$(function(){
    $('.price').each(function(){
        var price = $(this).text()
        $(this).text(accounting.formatMoney(parseFloat(price).toFixed(2), "€ ", 2, ".", ","))
    });
});