jquery - Using javascript to alter content of a <div> -


how alter content of <div> using javascript when <div> has no id or class.

i know using document.getelementbyid('foo').innerhtml = 'your content'; have been used if <div> had id. in case content want alter this

<div unselectable="on" style="position: absolute; padding: 2px; top: 0px; left: 1px; background-color: rgb(255, 102, 0); color: white;">boo</div> 

i partial using document.getelementsbytagname("div")[0].innerhtml = "boo"; find how proceed modify content? way doing things?

no there other div 1 content boo

if case, can find :contains

$("div:contains('boo')").html('hello'); 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -