title: JQuery function returning an object but its being integrated as undefined
body: <p>I am trying to get an object from function on button click.</p>
  
  <p>The function is returning an object(checked using Google tool) but the return value "tr" becomes undefined.</p>
  
  <p>Button</p>
  
  <pre><code>    $("#btnView").on("click", function () {
          var tr = GetActiveRow();       &lt;-- the tr value is coming as undefined 
          var itemNumber = tr.find("td").eq(0).html();
      });
  </code></pre>
  
  <p>Function</p>
  
  <pre><code>function GetActiveRow() {
  var rows = $(".datagrid tr:gt(0)");
  rows.each(function (index) {
      //If its currently active override it so we can mark new row
  
      var rowdata = $(this).data;
      if ($(this).data("isActive") == true) {
          alert($(this));
          return $(this).get(); &lt;-----object is being turned because the alert message is displayed 
      }
  });
  }
  </code></pre>