title: Alternative to event.srcElement.id
body: <p>Currently I have a function that works perfectly for IE, Chrome and Safari in order to get the ID name of a textbox I'm placing a focus on within a Gridview.</p>
  
  <pre><code>function onTextFocus() {
          alert(event.srcElement.id);
      }
  </code></pre>
  
  <p>The function is called upon during a RowDataBound for the gridview:</p>
  
  <pre><code>protected void ItemGridView_RowDataBound(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType == DataControlRowType.DataRow)
      {
          ((TextBox)e.Row.FindControl("txtQuantity")).Attributes.Add("onfocus", "onTextFocus();");            
      }
  }
  </code></pre>
  
  <p>However it doesn't work for Firefox as it doesn't recognize srcElement.  So I'm looking for an alternative that would work for all browsers.  After scouring Google I came up with these alternatives but I either get an undefined error or ReferenceError.  Any ideas why?</p>
  
  <pre><code>function onTextFocus() {
          alert(this.id);
          alert(event.currentTarget.id); 
          alert(event.target.id);    
          alert(event.currentTarget); 
          alert(event.target);                          
          alert($(this).attr('id'));
          alert($(obj).attr("id"));            
          alert($(this).id);
          alert($(this).get(0).id);            
          alert($(this).prop("id"));
      }
  </code></pre>