title: How to setting a Class in a conditional statement of Javascript?
body: <p>How to setting a Class in Javascript?
  I going to use Addthis sharing buttons in my website. The problem is that I need to have two different Styles of Sharing buttons in to my website, one to be shown in a computer browser and other for a mobile device.</p>
  
  <p>I'm going to use the below script. My question is how to include the code lines of two Styles sharing codes in the conditions of the javascript code? How to put the classes into the javascript condition because the sharing codes have Classes of CSS.</p>
  
  <pre><code>    &lt;script &gt;
      function detectmob() { 
       if( navigator.userAgent.match(/Android/i)
       || navigator.userAgent.match(/webOS/i)
       || navigator.userAgent.match(/iPhone/i)
       || navigator.userAgent.match(/iPad/i)
       || navigator.userAgent.match(/iPod/i)
       || navigator.userAgent.match(/BlackBerry/i)
       || navigator.userAgent.match(/Windows Phone/i)
       ){
          return true;  // Style for mobile devices
        }
  
       else {
          return false;  // Style for computer devices
        }
      }
  
  //Style for mobile devices
  &lt;!-- AddThis Button BEGIN --&gt;
  &lt;div class="addthis_toolbox addthis_default_style addthis_32x32_style"&gt;
  &lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_compact"&gt;&lt;/a&gt;
  &lt;a class="addthis_counter addthis_bubble_style"&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5149fd2b33068839"&gt;&lt;/script&gt;
  &lt;!-- AddThis Button END --&gt;
  
  // Style for Computer
  &lt;!-- AddThis Button BEGIN --&gt;
  &lt;div class="addthis_toolbox addthis_floating_style addthis_32x32_style" style="left:50px;top:50px;"&gt;
  &lt;a class="addthis_button_preferred_1"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_preferred_2"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_preferred_3"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_preferred_4"&gt;&lt;/a&gt;
  &lt;a class="addthis_button_compact"&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5149fd2b33068839"&gt;&lt;/script&gt;
  &lt;!-- AddThis Button END --&gt;
  </code></pre>