0

I have the following code which search for any dialogs which contains the text hello.

var found = $('span.ui-dialog-title:contains("hello")');

I need the same kind of statement but the dialog title must be exactly hello. Something like:

var found = $('span.ui-dialog-title:equals("hello")');

Unfortunately equals does not work.

Bronzato
  • 9,082
  • 27
  • 113
  • 203

1 Answers1

3

There is no equals selector. You need to use .filter() function instead.

$('span.ui-dialog-title').filter(function(){
  return $(this).text() === "hello";
});
Milind Anantwar
  • 79,642
  • 23
  • 92
  • 120