¿Cómo seleccionaría el elemento de mi lista desplegable por texto en lugar de valor?
Quiero seleccionar un elemento desplegable por texto con jQuery.
Hay una función de filtro en jQuery que puede usar para obtener elementos con algo más específico
$("select option").filter(function() { return $(this).text() == "text_to_select"; });Esto devolverá todas las opciones con "text_to_select" en el texto.
Creo que esto te servirá...
$("#selectId").find("option:contains('text')").each(function(){ if( $(this).text() == 'Text that should be matched' ) { $(this).attr("selected","selected"); } });