title: How To Get Value From Attribute Of " li " Using Jquery?
body: <p>Here I am trying to get the value from li attribute i.e <code>id="@item1.TaskId"</code> present in li on load of page using Jquery. <BR>
  But, as the page is loaded and jquery is executed the value in variable i.e taskId <code>var taskId = $("ul").find("li").attr("id");</code> is undefined.<br><br>
  Below id my Html consisting li with id i.e <code>id="@item1.TaskId</code> as attribute<br>
  <br></p>
  
  <pre><code>&lt;div class="col-md-6" style="font-family:'Century Gothic'"&gt;
  &lt;div class="panel panel-default " id="@ViewBag.statusIdForTask" sId="@ViewBag.statusName"&gt;
      &lt;div class="panel-heading" style="text-align:center; font-size:16px;font-family:'Century Gothic'"&gt;@ViewBag.statusName&lt;/div&gt;
      &lt;div class="panel-body"&gt;
          &lt;ul class="ui-sortable tasklistdiv sorttaskDP receive"&gt;
              @foreach (var item1 in Model)
              {
               &lt;li class="ui-sortable-handle panel-style bs-callout bs-callout-default receivepanel" id="@item1.TaskId" taskid="@item1.TskAssId" style="font-size:14px;text-align:justify; @styleClass"&gt;
              }
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><br></p>
  
  <p>Below is My Jquery<br></p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function () {
  
      var taskId = $("ul").find("li").attr("id");
  });
  &lt;/script&gt;
  </code></pre>