![](/img/trans.png)
[英]Remove the spaces between the closing and opening tag in html with JavaScript
[英]Append closing then opening HTML tag with Javascript/Jquery
我有一个场景,我想 append 一个结束标签,然后是第一个关闭标签的打开标签之后的一些其他标签。 例如:我有这个代码<ins>123678</ins>
我想 append <b>46</b>
在3
和6
之间。 我尝试了这段代码,同时将我的 cursor 放在3
到6
之间
document.execCommand('insertHTML',false,'</ins><b>45</b><ins>');
但这并没有给我想要的 output。 我想要我的 output 像这样
<ins>123</ins><b>45</b><ins>678</ins>
你可以尝试更换
<ins>123678</ins>
和
newHTML
="<ins>123"
+"<b>45</b>"
+"678</ins>"
使用 jquery
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.