Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting html into element that has

Status
Not open for further replies.

ZendDeveloper

Programmer
Jan 3, 2009
15
GB
Hope someone can help.

I have a page that changes depending on various scenarios. In one of these scenarios javascript adds a block of html to the dom and depending on whether a message is set this will then need to contain the contents of the message. Both the block of the html and the message are generated independently so I need to add the message to the newly generated and displayed block of html.

Does anyone know of a way to achieve this. I presume I need to get visibility of the added div id to be able to inject the message into it but have no idea on where to start.

I would prefer to use jQuery to achieve this but any suggestions more than welcome.

Thanks
 
If you know the ID of the element which needs the message adding and you know the message or have a variable with the message held in it you can simply change the html as follows.
Code:
document.getElementById('myID').innerHTML = myMess;

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Google Rank Extractor -> Perl beta with FusionCharts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top