[英]Replacing inner div content?
I'd like to replace the following inner div content: 我想替换以下内部div内容:
<div class="price"><span class="unit">$</span>37</div>
with this: 有了这个:
<del>$37</del> $19
The $37 gets striked through and the new price is displayed next to it. 删除$ 37,并在其旁边显示新价格。 The above
<div>
is generated dynamically. 上面的
<div>
是动态生成的。
I have tried the following but it isn't doing anything: 我已经尝试了以下方法,但是它什么也没做:
$( "div.price" ).replaceWith("<del>$37</del> $19");
I'm trying this in jquery but is there a way to do it in angular? 我正在jquery中尝试此操作,但是有没有办法做到有角度呢? I guess the issue with angular is that I can't add directives to the above code.
我猜想angular的问题是我无法在上述代码中添加指令。
run the code on document ready 准备好文档上的代码
// Code goes here
$(function(){
$( "div.price" ).html("<del>$37</del> $19")
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.