how to make function recognize id's of dynamically created elements in jquery
<pre><code>    $(document).ready(function() {                           
        $('#somebutton').click(function() {                  
            $.get('List', function(responseJson) {   
                $.each(responseJson, function(index, item) {
                    var elem=$('&lt;input type="checkbox" id="item" value='+item+'/&gt; ' + item + '&lt;br /&gt;');
                    $('#somediv').append('&lt;input type="checkbox" id="item" value='+item+'/&gt; ' + item + '&lt;br /&gt;');
                });
                $('#somediv').append('&lt;button id="newButton"&gt;'+"retrieve"+'&lt;/button&gt; &lt;br /&gt;');
            });
        });
        $("#newButton").click(function(){     
            var data = { 'checkBoxList[]' : []};     
            var list=$(":input:item:checked");    
            $(list.each(function() {        
                data['checkBoxList[]'].push($(this).val());     
                }));     
            $.get("Data",data,function(responseText){
                $('#somediv').text(responseText);
                }); 
            }); 
    });
</code></pre>

<p>(i'm new to jQuery)
What i'm trying to do is 
call a servlet ,which then gives me some list of checkboxes</p>

<p>select the required ones and then again submit to another servlet
which takes inputs from checkboxes 
to display the info based on selection.</p>

<p>getting list of checkboxes from servlet is working fine, which creates dynamically a button also
when i clicked the button, it doesn't do anything , i donno why</p>
