jQuery/XML return the current target li id from an xml node for individual functions
<p>I need to return the current value of the selected video-thumb li, so if I click on the 2nd li return id is 2 etc.  What I currently have returns 2 if I select both the first and second li.  I will eventually need to fire a different function depending on the selected li.  If this is totally off on reaching that goal please point me in the correct lead.</p>

<p>What I am trying to accomplish:  I parse the xml and then display it on the page (append it to #container).  Within the appended html, li are added.  Upon this addition I need to iterate to the correct target li.  So if I click target li with the xml id of 3 I need to fire a function for only that target li and so on for all iterated xml nodes.  Any direct as always is greatly appreciated.</p>

<p>Thanks!</p>

<p>jQuery:</p>

<pre><code>&lt;script type="text/javascript" src="js/jquery-1.6.2.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/video-js/video.js"&gt;&lt;/script&gt;
&lt;link rel="stylesheet" href="js/video-js/video-js.css" type="text/css" media="screen" title="Video JS" charset="utf-8"&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $.ajax({
        type: "GET",
        url: "videos.xml",
        dataType: "xml",
        success: function(xml) {
            $(xml).find('videos').each(function(){
                var title = $(this).find('title').text();
                var id = $(this).find('id').text();
                var url = $(this).find('url').text();
                var url2 = $(this).find('url2').text();
                var desc = $(this).find('desc').text();
                //alert(url2);
                $('#container').append('&lt;div id="desc"&gt;'+title+'&lt;br&gt;'+desc+'&lt;/div&gt;&lt;video class="video-js" width="740" height="400" controls="controls" preload="true"&gt;&lt;source src="'+url+'"/&gt;&lt;source src="'+url2+'"/&gt;&lt;/video&gt;&lt;li class="video-thumb"&gt;'+id+'&lt;/li&gt;');
                $('.video-thumb').click(function() {
                    if(id == 2){
                    alert("click = " + id);
                    } else {
                        return false
                    alert("loser");   
                    }
                })
            });
        }
    });
    //VideoJS.setupAllWhenReady();

});
</code></pre>

<p>XML:</p>

<pre><code>&lt;xml&gt;
&lt;videos&gt;
  &lt;title&gt;title one&lt;/title&gt;
  &lt;id&gt;1&lt;/id&gt;
  &lt;url&gt;videos/video1.mp4&lt;/url&gt;
  &lt;url2&gt;videos/video1.webm&lt;/url2&gt;
  &lt;desc&gt;111 Writing things in here.  Writing things in here.  Writing things in here.&lt;/desc&gt;
&lt;/videos&gt;
&lt;videos&gt;
  &lt;title&gt;title 2&lt;/title&gt;
  &lt;id&gt;2&lt;/id&gt;
  &lt;url&gt;videos/video1.mp4&lt;/url&gt;
  &lt;url2&gt;videos/video1.webm&lt;/url2&gt;
  &lt;desc&gt;2 Writing things in here.  Writing things in here.  Writing things in here.&lt;/desc&gt;
&lt;/videos&gt;
&lt;videos&gt;
  &lt;title&gt;title 3&lt;/title&gt;
  &lt;id&gt;3&lt;/id&gt;
  &lt;url&gt;videos/video1.mp4&lt;/url&gt;
  &lt;url2&gt;videos/video1.webm&lt;/url2&gt;
  &lt;desc&gt;3 Writing things in here.  Writing things in here.  Writing things in here.&lt;/desc&gt;
&lt;/videos&gt;
&lt;videos&gt;
  &lt;title&gt;title 4&lt;/title&gt;
  &lt;id&gt;4&lt;/id&gt;
  &lt;url&gt;videos/video1.mp4&lt;/url&gt;
  &lt;url2&gt;videos/video1.webm&lt;/url2&gt;
  &lt;desc&gt;4 Writing things in here.  Writing things in here.  Writing things in here.&lt;/desc&gt;
&lt;/videos&gt;
&lt;/xml&gt;
</code></pre>
