title: How to call xml (title) tags using Javascript
body: <p>I have one xml file which main root starts with:</p>
  
  <pre><code>&lt;design title="standard Cards 3.5 x 2" &gt;
        &lt;previews&gt;&lt;/previews&gt;
        &lt;previews1&gt;&lt;/previews1&gt;
        &lt;previews2&gt;&lt;/previews2&gt;
     &lt;/design&gt;
  </code></pre>
  
  <p>I want to read that xml files and get title tags and assign in option value.</p>
  
  <p>I also got this <code>design</code> root tags by using this <a href="http://www.w3schools.com/dom/dom_examples.asp" rel="nofollow">w3school method</a> .i want to get <code>design</code> --> <code>title</code> and stored into my select box:</p>
  
  <p>Here my code: </p>
  
  <pre><code>var selectHTML = "";
  selectHTML += "&lt;select name='something' id='media' onchange='select();'&gt;";
  for (i = 0; i &lt; total.length; i = i + 1) {
      if (total[i] != '') {
          xmlDoc = loadXMLDoc($loc);
          var fruits = xmlDoc.documentElement.nodeName;
          if (fruits) {
              alert(fruits);
              var name = xmlDoc.getElementsByTagName("design")
              alert(name);
          }
          selectHTML += "&lt;option value='" + total[i] + "'&gt;" + name + "&lt;/option&gt;";
      }
  }
  selectHTML += "&lt;/select&gt;";
  </code></pre>
  
  <p>Here <code>xmlDoc=loadXMLDoc($loc);</code> is calling method of xml files.I refer this from <a href="http://www.w3schools.com/dom/dom_nodes_access.asp" rel="nofollow">w3school tutorial</a></p>
  
  <p>I just alerting <strong><code>name</code></strong>  it resulting undefined. How to solve this? </p>
  
  <p>I want to place <strong><code>name</code></strong> value into my select box option value. How to read xml files using javascript and place into option value?</p>