replacing the superfluous 'innerHTML' with something else. Javascript -


im looking replacement .innerhtml.. can clear div , replace string of code have.. problem innerhtml forces me use superfluous code (anyone know why?) // , can't seem break '<br> more once in line..

ive tried search answer cant find any. appreciated.

use jquery.

  $('#mydiv').replacewith(whatever); 

that replace entirety of dom element whatever put in it's place..

$('#mydiv').html(whatever); 

that retain dom element while replacing of contents of div in same way innerhtml does.

$('#mydiv').append(whatever); 

that retain dom element , it's content , add content onto of element.

$('#mydiv').prepend(whatever); 

that retain dom element , it's content , add content onto front of element.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -