JSFiddle - React, Tailwind, and code Playground

by rwaldron

HTML

<select>
<option value="a">alpha</option>
<option value="b">beta</option>
</select>

JavaScript

var $select = $("select"), 
clone = $select.clone(true);

$("body").append( clone );


console.log( $("select") );


//change the Text;
$("select").each(function() {
    console.log($(this).children("option"))
    $(this).children("option").each(function() {
        console.log( "original:", [$(this).text(), $(this).val()] )
        $(this).text("dddd");

        console.log( "updated:", [$(this).text(), $(this).val()] )
    });
});