title: Changing value of button using typescript
body: <p>I'm currently trying to make my button (which says "Add to Favorites) change to "Remove from Favorites" once it's clicked. I've tried a lot of the solutions on this site (for both java and textscript), but nothing seems to be working. </p>
  
  <p>My code:</p>
  
  <pre><code>button(id='addToFav', onclick='addToFavorites()') Add to Favorites
  script.
    function addToFavorites(){
    var x = document.getElementById("addToFav").value;
    if (x=="Add to Favorites") {
        x = "Remove from Favorites";
    } else {
        x = "Add to Favorites";
    }
    }
  </code></pre>
  
  <p>Thank you for the help!</p>