Quantcast
Channel: JavaScript Changing HTML Content - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Zakaria Acharki for JavaScript Changing HTML Content

$
0
0

Just like @j08691 mentioned in the above comment you should add quotes to getElementById() :

document.getElementById("changeString").innerHTML = "You have successfully run the report."
________________________^____________^

And to use == or === in your condition for comparison instead of equal = that used for assignment:

if (bananas === true){

And it will work as you could see below.

Hope this helps.

document.addEventListener("DOMContentLoaded", function(event) { 
  var bananas = true;

  if (bananas === true){
    document.getElementById("changeString").innerHTML = "You have successfully run the report."
  }
});
<div class="cell text-center" id="changeString"> Report has not yet been pulled for this organization.</div>

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>