title: How do I add/remove elements in a jQuery Mobile navbar?
body: <p>In jQuery Mobile, lets say I have the following navigation bar:</p>
  
  <pre><code>&lt;div data-role="navbar"&gt;
      &lt;ul&gt;
          &lt;li&gt;&lt;a id="item1"&gt;Item 1&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="item2"&gt;Item 2&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="item3"&gt;Item 3&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I can then just use jQuery to remove an item to make this look like:</p>
  
  <pre><code>&lt;div data-role="navbar"&gt;
      &lt;ul&gt;
          &lt;li&gt;&lt;a id="item1"&gt;Item 1&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="item3"&gt;Item 3&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>However, jQuery Mobile still renders it as if there are three tabs, and in the middle one, there is just nothing there. So instead of it being spaced out with each tab taking 1/2 of the width, each of the two remaining tabs just takes 1/3 of the width.</p>
  
  <p>I looked closer and jQuery Mobile automatically adds a class to the <code>&lt;ul&gt;</code> element called "ui-grid-b" and if I change that manually to "ui-grid-a" it then looks fine and the two tabs take up the whole width. However, changing those classes manually seems too hackish and I'm guessing there is a better way to do it. Any ideas?</p>