title: Based on internet connection change color of button to green or grey
body: <p>I want the button itself to change its color when online(based on internet connection) to green otherwise gray.</p>
  
  <p>I have a JS fiddle which gives a solution to click the button and we can see if we are online/offline by an alert.</p>
  
  <p>Can someone please help</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div data-role="page" id="index"&gt;
    &lt;div data-theme="a" data-role="header"&gt;
      &lt;h3&gt;First Page&lt;/h3&gt; &lt;a href="#second" class="ui-btn-right"&gt;Next&lt;/a&gt; &lt;/div&gt;
    &lt;div data-role="content"&gt; &lt;a data-role="button" id="check-connection"&gt;Check internet connection&lt;/a&gt; &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>$(document).on('pagebeforeshow', '#index', function() {
    $(document).on('click', '#check-connection', function() {
      var status = navigator.onLine ? 'online' : 'offline';
      (alert(status));
    });
  });
  </code></pre>
  
  <p>See <a href="http://jsfiddle.net/Gajotres/VXWGG/1/" rel="noreferrer">JSFiddle</a>.</p>