title: jQuery/JavaScript - event.target.id on Firefox
body: <p>I have a short script written which works fine on Chrome:</p>
  
  <pre><code>function updateSentence(){
      $(document).ready(function() {
          t = event.target.id;
          $("#S"+t).html($("#"+t).val());
      });
  }
  </code></pre>
  
  <p>However, in Firefox event is not defined. I've found some similar questions which suggested that event needs to be passed in as a parameter to the function:</p>
  
  <pre><code>function updateSentence(event){
      $(document).ready(function(event) {
          t = event.target.id;
          $("#S"+t).html($("#"+t).val());
      });
  }
  </code></pre>
  
  <p>Yet, for me this solution does not fix the Firefox problem, and it actually breaks how it works in Chrome. In Chrome, it ends up saying that <code>event.target</code> is not defined when these are passed.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>After receiving a few comments I've realized that how I was thinking about jQuery in general was wrong. I did not want <code>$(document).ready</code> called on every update of the sentence. Cleaning up the function with this knowledge I ended up with:</p>
  
  <pre><code>function updateSentence(){
      t = event.target.id;
      $("#S"+t).html($("#"+t).val());
  }
  </code></pre>
  
  <p>This still correctly updates the sentence in Chrome, yet <code>target</code> continues to be undefined in Firefox. What might I need to do to get this to work in Firefox? And am I still doing something fundamentally wrong in jQuery?</p>
  
  <p>Also, to answer a question in the comments, the event I'm looking for is the <code>onchange</code> event that triggered <code>updateSentence()</code>. This should be called when a select/text field is changed.</p>
  
  <p>(I'm still new to <a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow">jQuery</a> and <a href="http://en.wikipedia.org/wiki/JavaScript" rel="nofollow">JavaScript</a> in general, and I'm sure I'm just making a simple mistake.)</p>
  
  <hr/>
  
  <p>I found my answer. I will post in a couple hours when the site allows me to.</p>