Skip to main content

Bug Tracker

Side navigation

#9731 closed enhancement (wontfix)

Opened July 02, 2011 06:25PM UTC

Closed July 02, 2011 07:06PM UTC

Extend :contains() selector on input fields.

Reported by: Owned by:
Priority: undecided Milestone:
Component: selector Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:

jQuery should be able to select input fields that contains a dynamic value (I don't mean anything by using the "[value=input value]") when the page is loaded.

So for example, the user inputted "John Resig" you could select it with the dynamic value with this:

$("input:contains('John Resig')");

This would make it easier instead doing a .each loop then checking if the .val matches it.

Attachments (0)
Change History (1)

Changed July 02, 2011 07:06PM UTC by dmethvin comment:1

component: unfiledselector
resolution: → wontfix
status: newclosed

The jQuery team has decided to encourage convergence towards the standard W3C CSS selector syntax and not add more jQuery-specific selector extensions. That way, selectors can be processed by the standard querySelectorAll method. At the moment, any selector that uses jQuery selectors must go through Sizzle's Javascript path which has a significant performance penalty.

You can easily write your own plugin to do this, here is a start:

jQuery.fn.hasValue = function(text){
   return this.filter(function(){
     return this.value === text;