JSFiddle - React, Tailwind, and code Playground

by tamilselvan

HTML

<select id="country"> 
    <option> Some contents</option>
    <option> Contents go beyont the limit spacious enough may be</option>    
</select>

CSS

select{
    width : 150px;
}

JavaScript

/* To trim the charaters in the option list */
	var optLen = $('#country option').size();
	//console.log("Total length is :" +optLen);
	for(var i=0; i<optLen; i++){
		var txt = $('#country option').eq(i).text();
		//alert(txt);
		txt = txt.substring(0,20);
		//alert(txt);
		$('#country option').eq(i).text(txt);
	}