title: jQuery UI CSS styles not being applied to menu bar generated with getJSON
body: <p>I am trying to generate a jQueryUI menubar using JSON data. The JSON is being parsed correctly into valid HTML; however, the menubar displays as an unstyled unordered list and not as a styled menubar as the top one seen on <a href="http://view.jqueryui.com/menubar/demos/menubar/default.html" rel="nofollow">http://view.jqueryui.com/menubar/demos/menubar/default.html</a>. Note that the routine which converts the JSON data to HTML does not go deeper than one menu level at this time, so the sub-menu options (Open, Save, Close, etc.) are intentionally not read.</p>
  
  <p>For some reason, if I hard-code the exact same HTML as what is generated by the jQuery method below in <code>menuBar.jsp</code>, the menubar styling displays just fine.</p>
  
  <p>Here is the main page (<code>appFrameNew.jsp</code>):</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;    
  
  &lt;title&gt;Menu Test&lt;/title&gt;
  
      &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" /&gt;
      &lt;link rel="stylesheet" href="http://view.jqueryui.com/menubar/themes/base/jquery.ui.menu.css" /&gt;
      &lt;link rel="stylesheet" href="http://view.jqueryui.com/menubar/themes/base/jquery.ui.menubar.css" /&gt;
  
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;    
      &lt;script src="http://view.jqueryui.com/menubar/ui/jquery.ui.core.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="http://view.jqueryui.com/menubar/ui/jquery.ui.widget.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="http://view.jqueryui.com/menubar/ui/jquery.ui.menu.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="http://view.jqueryui.com/menubar/ui/jquery.ui.menubar.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="http://view.jqueryui.com/menubar/ui/jquery.ui.position.js" type="text/javascript"&gt;&lt;/script&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
  
      &lt;div id="layout" class="layout"&gt;
  
         &lt;jsp:include page="menuBar.jsp" flush="true" /&gt;
  
      &lt;/div&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Here is <code>menuBar.jsp</code>:</p>
  
  <pre><code>&lt;div class="demo"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
      function select(event, ui) {
          if (ui.item.text() == 'Quit') {
              $(this).menubar('destroy');
          }
      }
      $(function() {
          $("#bar1").menubar({
              position: {
                  within: $(".demo").add(window).first()
              },
              select: select
          });
      });
  
  $.getJSON('menuBarTestJSON.json', function(data) {
      var output='&lt;ul id="bar1" class="menubar"&gt;';
      for (var i in data.menuOptions) {
          output+='&lt;li&gt;&lt;a href="#"&gt;' + data.menuOptions[i].menubarItem + '&lt;/a&gt;&lt;/li&gt;';
      }
      output+="&lt;/ul&gt;";
      $(".demo").html(output);
  });
  
  &lt;/script&gt;
  
  &lt;ul id="bar1" class="menubar"&gt;
      &lt;li&gt;
          &lt;a href="#File"&gt;File&lt;/a&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;a href="#Open"&gt;Open&lt;/a&gt;
              &lt;li&gt;&lt;a href="#Save"&gt;Save&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>And lastly, <code>menuBarTestJSON.json</code>:</p>
  
  <pre><code>{"menuOptions":[
      {
          "menubarItem":"File",
          "menuElement": {
              "option":"Open",
              "option":"Save",
              "option":"Close",
              "option":"Quit"
          }
      }
  ]}
  </code></pre>
  
  <p>I've been futilely searching the web for a solution for a few days now and need to move on in this project as soon as possible. Any assistance is greatly appreciated. Thank you.</p>