html - Javascript innerHTML is not getting updated -


hi trying update innerhtml of following script

<div id="global-alert-queue" class="layout-wrapper">  <div class="alert success animate-in" role="alert">  submission successful.  <button id="dismiss-alert" class="dismiss" type="button"></button>  </div>  </div>

i have tried following

var cls =document.getelementbyid("global-alert-queue").getelementsbyclassname("animate-in")[0].innerhtml = "change text";

but not working.

see comments inline:

// run when document rendered , ready manipulated  document.addeventlistener("domcontentloaded", function () {     document.queryselector("#global-alert-queue .animate-in").innerhtml = "change text"; }); 

demo: http://jsfiddle.net/tusharj/kg3cc4gw/3/

queryselector

returns first element within document (using depth-first pre-order traversal of document's nodes) matches specified group of selectors.

more on queryselector: https://developer.mozilla.org/en-us/docs/web/api/document/queryselector


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -