Skip to content

Instantly share code, notes, and snippets.

@wholypantalones
Created November 30, 2012 15:24
Show Gist options
  • Select an option

  • Save wholypantalones/4176407 to your computer and use it in GitHub Desktop.

Select an option

Save wholypantalones/4176407 to your computer and use it in GitHub Desktop.
Exact match text :contains() workaround
$.expr[":"].econtains = function(obj, index, meta, stack){
return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
}
$("#select option:econtains(" + thisText + ")").prop("selected", true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment