Getting the ID of an li using jquery
<pre><code>&lt;li id ="+ "'" + response.set[i].LessonID + "'" +"&gt;" + response.set[i].no_of_questions[x].informed + "&lt;/li&gt;"
</code></pre>

<p>The above code is supposed to set the ID of a list item to a variable in json array. My issue is I want to be able to pick the ID from the list generated and store it in local variable. Can anyone help ? I want something specific to this situation.
This is the Code I was using :</p>

<pre><code>$('li').click(function() {
    var listId = (this).attr('id');
    alert($(this).attr('id'));
})
</code></pre>