Change all Elements (html) of a div on changing the language?
<p>I have a dropdown menu on my page which has language selector options. on selecting the language i want my labels and buttons html to be changed according to the language?
<strong>My Code</strong></p>

<pre><code>var arr = [];
    //  gets all the ids starting with comp_
    $('div[id^="comp_"]').each(function(){
        arr.push(this.id);
        labels = $(this).find('label');
        buttons = $(this).find('button');

        //get all labels inside the current div
        $(labels,buttons).each(function(){
            $(this).html("");
        });

    });
    console.log(arr);
},
</code></pre>

<p>*<em>Problem *</em>
It only changes the label element reference and not the button reference.can i run the function on multiple element references?</p>

<p><strong>It Works if I do this but i dont want to repeat the same code again for diffferent references</strong></p>

<pre><code>    var arr = [];
    //  gets all the ids starting with comp_
    $('div[id^="comp_"]').each(function(){
        arr.push(this.id);
        labels = $(this).find('label');
        buttons = $(this).find('button');

        //get all labels inside the current div
        $(labels).each(function(){
            $(this).html("");
        });

        $(buttons).each(function(){
            $(this).html("");
        });

    });
    console.log(arr);
},
</code></pre>
