$(document).ready(function(){ $('.lang-skinnable-select').each( function(i) { selectContainer = $(this); // Remove the class for non JS browsers selectContainer.removeClass('lang-skinnable-select'); // Add the class for JS Browers selectContainer.addClass('skinned-select-lang'); // Find the select box selectContainer.children().before('
a
').each( function() { $(this).prev().text(this.options[this.selectedIndex].innerHTML) } ); // Store the parent object var parentTextObj = selectContainer.children().prev(); // As we click on the options selectContainer.children().click(function() { // Set the value of the html parentTextObj.text(this.options[this.selectedIndex].innerHTML); }) } ); $('.my-skinnable-select').each( function(i) { selectContainer = $(this); // Remove the class for non JS browsers selectContainer.removeClass('my-skinnable-select'); // Add the class for JS Browers selectContainer.addClass('skinned-select'); // Find the select box selectContainer.children().before('
a
').each( function() { $(this).prev().text(this.options[this.selectedIndex].innerHTML) } ); // Store the parent object var parentTextObj = selectContainer.children().prev(); // As we click on the options selectContainer.children().click(function() { // Set the value of the html parentTextObj.text(this.options[this.selectedIndex].innerHTML); }) } ); });