JSFiddle - React, Tailwind, and code Playground

by pradeep

HTML

<select>
 <option>India (+91)</option>
 <option>Afganisthan (+145)</option>
 </select>

JavaScript

$('select').each(function(){
    var selectedCountry = $(this).children("option").val();
    var result = selectedCountry.match(/\((.*)\)/);
    alert(result[1]);//this will show the value of the atribute of that option.
    $(this).children("option").attr("data-value",result[1]);
});