使用jQuery;替换时添加跨度类别时添加跨度类功能
我认为我的问题很容易解决,但我没有找到与此相关的任何问题。我只想在使用jQuery替换时添加类ID。
在这里,我正在使用这个小脚本:
<script>
$("body").html($("body").html().replace(" <strong>Mario</strong> game" , " <span class="class-id"><strong> Mario</strong> bros."));
</script>
您能帮我吗?谢谢
I think my problem is simple to resolve but i didn't find anything related to this. I just want to add a class id when i use JQuery replace.
Here i'm using this small script :
<script>
$("body").html($("body").html().replace(" <strong>Mario</strong> game" , " <span class="class-id"><strong> Mario</strong> bros."));
</script>
Can you help me? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
示例
在这里呢:
https://codepen.io/polinq/polinq/pen/pen/yllknggv?editors=1111111111111111111111111111111111111111
what about
Example here:
https://codepen.io/polinq/pen/yLKNggV?editors=1111