Jquery passing string to function
<p>I want to pass the name of my list into my function, but it's not working correctly. I am trying to pass an array and a string to my function. I want to replace "#myGallery_2" to be dynamic. How would I do this correctly? This is what i'm currently trying.</p>

<pre><code>var src = $('#'+id+ li:nth-child('+index+')')

&lt;ul id="myGallery_2"&gt;
&lt;li&gt;&lt;/li&gt;
&lt;li&gt;
&lt;/ul&gt;
</code></pre>

<hr>

<pre><code>var images= [
    'IMG_3872_s.jpg',
    'IMG_3926_s.jpg',
    'IMG_3929_s.jpg',
    'IMG_3930_s.jpg'
         ];  




$('#menu li:nth-child(2)').click(function(){
addThumbs(images, '#myGallery_2');
});
</code></pre>

<hr>

<h2>Function</h2>

<pre><code>function addThumbs(paths,id) {

        $.each(paths,function(index, value) {
        var str = value; 
        var big_img=str.replace("_s","_b");
        var src = $('#myGallery_2 li:nth-child('+index+')').find('img').attr('data-frame', value);
        var src = $('#myGallery_2 li:nth-child('+index+')').find('img').attr('src', big_img);
        });
</code></pre>
