how to get data by clicking on item from listview that created dynamic?
<p>i created a dynamic list view and i want to get the data from the line in the listview that i click on (the data is displayed on the listview, so the 'append' works perfect) , i get "undefind" when i click and try to get tha data into "x" and i don't understand why!</p>

<p>my code:</p>

<pre><code>for (var i = 0; i &lt; json_parsed.Categories.length; i++){
        var cars= json_parsed.Categories[i];


        $('#categoryList').append($('&lt;li   data-categoryId = cars.car_name&gt;').html(' &lt;a href="#"  onclick = "temp()" &gt;'+cars.car_name+&lt;/a&gt;'));
}


function temp () {
   var x = $(this).data('categoryId');  
   alert (x);   
};
</code></pre>

<p>thanks Ahead</p>
