且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用javascript从div内容中删除标记

更新时间:2023-12-05 20:35:28

试试这个,

 

( '#myDiv')的HTML()代替(/(≤([^>] +)>)/ IG, );


给你的
一个id值。



使用带有id的javascript DOM访问documentgetElementById()你的


取决于你真正想做的事情,使用.innerHTML或.innerText


(你的价值似乎只是文字)。






Hi,

my div content as below.

LEFT KNEE DEGENERATIVE DISEASE AND MEDIAL MENISioiCUS TEAR.


i want to change the div content as below


LEFT KNEE DEGENERATIVE DISE{#REV#}{#REM#}A{#REM#}{#REV#}SE AND MEDIAL MENIS{#REV#}{#INS#}ioi{#INS#}{#REV#}CUS TEAR.


how can i do this using javascript?..gttg no idea...


Thanks..

Try this,


('#myDiv').html().replace(/(<([^>]+)>)/ig,"");


give your
an id value.

Use javascript DOM access documentgetElementById() with the id of your

Depending upon what you actually wish to do, change the value using .innerHTML or .innerText

(your value appears to be just text).