简体   繁体   English

如何使用prototype.js在一段文本后插入内容?

[英]How do I insert content after a block of text using prototype.js?

I am trying to insert a block of html code using prototype.js 我正在尝试使用prototype.js插入html代码块

I have been able to do this when I target an html element such as 当我将html元素作为目标时,我已经能够做到这一点

$('footer').insert({top: '<div id="footer_inner"><small>CompanyName, LLC</small></div>'})

Is it possible to inset a div after text such as 是否可以在诸如

James McCarthy (level3) 詹姆斯·麦卡锡(Level3)

Is it possible to target the text level3? 是否可以定位文本级别3? and insert a block html after it? 并在其后插入一个html块?

Thanks in advance 提前致谢

Sure. 当然。 Just use after as the first parameter for insert() : 只需将after作为insert()的第一个参数即可:

$('level3').insert({after: '<p>HTML goes here</p>'});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM