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,438
  • 29
  • 120
  • 212

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
  • 81,290
  • 25
  • 94
  • 125