![](/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.