Tuesday, September 27, 2016

How to set dropdown value by text using jquery

This is just a quick post to show how to set dropdown value by text using jquery. This is a method that works based on the text of the option, not the index. $("#YourDropDownId option").each(function() { if($(this).text() == TextToBeDisplayOrSelected) { $(this).attr('selected', 'selected'); } }); Special Thanks To : Stackoverflo...