简体   繁体   中英

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

I have been able to do this when I target an html element such as

$('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)

Is it possible to target the text level3? and insert a block html after it?

Thanks in advance

Sure. Just use after as the first parameter for insert() :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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