Unable to return value from a function
<p>I want to return value from the function which contains an anonymous function. </p>

<pre><code>function getSingleCheckedItemId() {
    return $(".data-table-chk-item").each(function() {
      if ($(this).is(":checked")) {
          var value = $(this).attr("value");
          return value;
      }
    });
  }
</code></pre>

<p>In this case it returns me the array of all checkboxes. If I remove the first <code>return</code>, it won't return a value but <code>undefined</code>.</p>

<p>So how do I return the value from <code>getSingleCheckedItemId()</code>?</p>
