title: Correct syntax for IF statement
body: <p>Can anyone tell me why this IF statement doesn't work, please? I'm using jQuery and Firebug but the latter is not giving me any useful information.</p>
  
  <p>I'm simply attempting to reveal a "submit" button when all of the fields have been completed and the script runs every couple of seconds to check for input.</p>
  
  <p>My code excerpt goes a little like this:</p>
  
  <pre><code>function checkForm(){
      var userName = $('#name').val();
      var userContent = $('#content').val();
      var userEmail = $('#email').val();
  
      // The following line shows me that the values for the fields are all getting picked up properly
      $('#report').html("userName: "+userName+"&lt;br /&gt;userContent: "+userContent+"&lt;br /&gt;userEmail: "+userEmail);
  
      // But the following line is throwing some kind of error
      if (userName == "" || userContent == "" || userEmail == ""){
          $('#update').slideDown();
      } else {
          $('#update').slideUp();
      }
  }
  
  $(document).ready(function(){
  
      $('#update').hide();
      setInterval('checkForm()' , 2000);
  
  });
  </code></pre>
  
  <p>And my HTML...</p>
  
  <pre><code>&lt;div id="report"&gt;&lt;/div&gt;
  &lt;form id="submitfact"&gt;
    &lt;div id="update"&gt;Update Database&lt;/div&gt;
    &lt;label&gt;&lt;input id="name" name="name" type="text" value="" /&gt;&lt;span&gt;Fact submitter's name&lt;/span&gt;&lt;/label&gt;
    &lt;label&gt;&lt;input id="email" name="email" type="text" value="" /&gt;&lt;span&gt;Fact submitter e-mail address&lt;/span&gt;&lt;/label&gt;
    &lt;label class="content"&gt;&lt;span&gt;Fact text&lt;/span&gt;&lt;br /&gt;&lt;textarea id="content" name="content"&gt;&lt;/textarea&gt;&lt;/label&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Edit...</strong></p>
  
  <p>I apologise if people think I'm wasting their time by not providing the error message - but Firebug simply isn't giving me anything useful - if it was I'd be posting it here. I am a reasonably experienced php programmer but fairly new to jQuery so I admit I am still getting to grips with both writing the language and debugging it. I'd like to post a screen shot of Firebug's response but, as a new user, I am not allowed... all I am getting is a "red error circle/yellow play triangle" icon in the line numbers column ("script" tab) on the line I've shown above... there is nothing else unless you can tell me where else to look other than the "script" and "console" panels?</p>
  
  <p><strong>Another edit...</strong></p>
  
  <p>Well, I got it fixed by taking a look at Cristoph's suggestion. It's basically the same solution but instead of calling it as a function I put it "inline". I'm not entirely sure what the difference between the two techniques is or whether it's simply a local issue I was having but my new jQuery looks like this:</p>
  
  <pre><code>$(document).ready(function(){
      $('#submitfact').keyup(function(){
          var userName = $('#name').val();
          var userContent = $('#content').val();
          var userEmail = $('#email').val();
  
          $('#report').html(userName + "&lt;br /&gt;" + userContent + "&lt;br /&gt;" +  userEmail);
  
          if (userName == "" || userContent == "" || userEmail == ""){
              $('#update').slideUp();
          } else {
              $('#update').slideDown();
          }
      });
  });
  </code></pre>
  
  <p>I will have a look through your other comments to see if I can streamline it at all but at least I have a working baseline now! Thanks for your time, everyone :)</p>