title: call innerHTML based on a condition from jsp code in spring mvc
body: <p>I am trying to find a way to have the document.getElementById("1").innerHTML to get triggered based on a condition coming from jsp code. <br/><br/>
  For example I have the following jsp code on the jsp page,</p>
  
  <pre><code>&lt;table border="1"&gt;
  &lt;c:forEach items="${elements}" var="element"&gt;
      &lt;tr&gt;
          &lt;td&gt;${element.elementNumber}&lt;br /&gt; ${element.isReserved}
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/c:forEach&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Based on "element.isReserved", I need to change an element (supposedly using .innerHTML)in html. The element in html looks like the following. I have several of these elements. </p>
  
  <pre><code>            &lt;div class="col-xs-2"&gt;
                  &lt;div class="o-btn"&gt;
                      &lt;a id="1" onClick="myFunction(this);"&gt;1&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="clearfix"&gt;&lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>As shown above, it is displayed as a button with value "1". I want to change the value to "X" based on a condition. I can do this directly with js,</p>
  
  <pre><code>&lt;script&gt;
          function myFunction(elmnt) {}
          function isReserved() {
              return 'X';
          }
          document.getElementById("1").innerHTML = isReserved();
  &lt;/script&gt;
  </code></pre>
  
  <p>But I need to make it dependent on the output from spring or the jsp code shown above. My desired output is that the "1" displayed on the button will change to a "X" when the element.isReserved() (inside the jsp code) evaluates to true. Since I have several of the button elements, I need to check for every button if element.isReserved() evaluates to true.</p>