Bug Tracker

Opened 12 years ago

Closed 12 years ago

#9731 closed enhancement (wontfix)

Extend :contains() selector on input fields.

Reported by: waynepurtonsmith@… Owned by:
Priority: undecided Milestone: 1.next
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.

Change History (1)

comment:1 Changed 12 years ago by dmethvin

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;
Note: See TracTickets for help on using tickets.