JSFiddle - React, Tailwind, and code Playground

by jjay225

HTML

<select id="drop1"><option value="1">Person</option><option value="2 ">Organization</option></select>
<input type="button" id="butweb" value="set" />

JavaScript

var item='hello there again'.replace(/[' ']/g,'');
alert(item);

$("#butweb").on("click",function()
{
    $("#drop1").val(2);    
    $("select#drop1 option").each(function()
    {
       var newval=$(this).val().replace(/[' ']/g,'');
       if(newval==2)
       {           
        $(this).val(newval);
         $("#drop1").val(2); 
       }           
    });                             
});