title: Dynamically change css style by class name
body: <pre><code>&lt;p class="typeA build1"&gt; Build 1 &lt;div class="b"&gt;Complete&lt;/div&gt;&lt;/p&gt;
  &lt;p class="typeA build2"&gt; Build 2 &lt;div class="b"&gt;Incomplete&lt;/div&gt;&lt;/p&gt;
  //about 6 or 7 more builds...
  </code></pre>
  
  <p>I need to access the style of build# to change the display...all are originally hidden but I hava java code that creates a string/s (ex. "build2" and "build3").
  I have that string saved as "tempKey" in my JAVA code.</p>
  
  <p>Then in a javascript script:</p>
  
  <pre><code>var tempKey = "&lt;%=tempKey%&gt;";
  document.getElementsByClassName(tempKey).style.display = "block !important";
  </code></pre>
  
  <p>I have also tried adding a class "active" and had that class have the same style (block !important), plus a number of different ways to solve this. It seems I just can't access the element right using the java string in a javascript function.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I am accessing the right element, but it won't let me overwrite the display style from none to block. For some reason !important is not working...</p>