使用javascript从div内容中删除标记 [英] Remove tag from div content using javascript

查看:110
本文介绍了使用javascript从div内容中删除标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的div内容如下。



LEFT KNEE DEGENERATIVE DISE A SE AND MEDIAL MENIS ioi CUS TEAR

< br $>


i想要改变div内容如下





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





我怎么能用javascript做这个?.. gttg不知道......





谢谢..

解决方案

试试这个,

 

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


给你的

一个id值。



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



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


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





< b>

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).



这篇关于使用javascript从div内容中删除标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆