I have a page with h1 and h2 where I would like to make h1's content dynamically change depending on the value of a specific cookie. I have created a cookie which stores test results of the user (ranging 1-9) and I would like to set a different h1 for each number.
The code that I have is the following but it doesn't seem to work :
function CTAtext () {
    var cookie = getCookie("resultNum");
    var text1 = document.getElementsByClassName("item-h1")[0].innerHTML;
    var text2 = document.getElementsByClassName("copy-text")[0].innerHTML; 
    
  if (cookie == null) {
    text1 = Green; }}
 
