Search code examples
sizzle

Sizzle text equals


With the Sizzle selector engine, is it possible to find buttons with the exact text?

For example, button:contains('Remove Document') will match any buttons that have the text "Remove Document" but I need it to not match buttons that say "Don't Remove Document". Is there a selector that will match the whole text, start to finish?


Solution

  • You can put :contains inside :not to not match something :

    $("button:not(:contains(Don't Remove Document))")
    

    FIDDLE