title: innerHTML not working in if/else
body: <p>I'm making a small text-based game and I'm trying to incorporate some background music through Youtube-embeds. Probably not the best solution, but for my goal it works :)</p>
  
  <p>I have a Javascript database built up with multiple data collections, built up like this:</p>
  
  <pre><code>{
          "question":"blabla.",
          "answers":[
              {"title":"Left","response":3},
              {"title":"Right","response":2}
              ],
          "youembed":"&lt;iframe id='youtube' width='100' height='100' src='http://www.youtube.com/embed/VIIOVtWGSj8?autoplay=1' frameborder='0' allowfullscreen&gt;&lt;/iframe&gt;"
      },
  </code></pre>
  
  <p>I place the content from the database in my HTML with the following piece:</p>
  
  <pre><code>document.getElementById("question").innerHTML = db[currentLocation].question;
  </code></pre>
  
  <p>However, I only want the <code>youembed</code> to actually be placed in the HTML, if the length of <code>db[currentLocation].youembed</code> is over 0.</p>
  
  <p>So I wrote the following:</p>
  
  <pre><code>if (youembed &gt; 0) {
      document.getElementById("youembed").innerHTML = db[currentLocation].youembed;        
  }
  </code></pre>
  
  <p>Whenever I use the <code>document[..].youembed</code> outside of the if-statement, it works without a problem, however, I want it to work IN the if-statement, so it doesn't replace the current playing song, until <code>db[currentLocation].youembed</code> is > 0</p>
  
  <p>What am I doing wrong? I have an <code>alert(youembed)</code> placed in the code, so I can see the length and it does show me that one youembed is 0, the other on page 2 is 145, but it doesn't run the <code>if</code>-statement in that case.</p>
  
  <p>Here's the complete Javascript code:</p>
  
  <pre><code>var currentLocation = 0;
  
  window.printCurrentLocation = function(){
      document.getElementById("question").innerHTML = db[currentLocation].question;
      var youembed =  db[currentLocation].youembed;
      alert(youembed.length);
      if (youembed &gt; 0) {
          document.getElementById("youembed").innerHTML = db[currentLocation].youembed;        
      }
      else {
  
      }
  
      var answers = "";
      for(var i=0,l=db[currentLocation].answers.length;i&lt;l;i++){
          answers += "&lt;p&gt;&lt;button onclick='setLocation("+db[currentLocation].answers[i].response+")'&gt;"+db[currentLocation].answers[i].title+"&lt;/button&gt;&lt;/p&gt;";
      }
      document.getElementById("answers").innerHTML = answers;
  }
  
  window.setLocation = function(num) {
      currentLocation = num;
      window.printCurrentLocation();
  }
  
  window.printCurrentLocation();
  </code></pre>