title: How to change the innerText of an <a> using javascript
body: <p>When I click on the "show details" link it should change to "hide details". I tried the following code but it's not working:</p>
  
  <pre><code>out.print("&lt;a href=\"javascript:parent.showHideDetails('"+id+"',this);\"&gt;show details&lt;/a&gt;");
  
  function showHideDetails(id,obj) {
      try
      {
  
          alert(obj.innerText);
          obj.innerText = 'hide details';
      }
      catch (err)
      {
          alert(err);
      }
  
  }
  </code></pre>