Bug Tracker


Ticket #5868 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

:contains() Selector fails to find match when string is passed as a variable

Reported by: gloddy Owned by:
Priority: major Milestone: 1.4.1
Component: unfiled Version: 1.4
Keywords: contains Cc:
Blocking: Blocked by:


Passing :contains a direct string works: $('ul li:contains("One")').fadeOut();

But passing that same string as a variable fails:

value_in_variable = "Two"; $('ul li:contains(value_in_variable)').fadeOut();

I've attached a standalone html example file.


contains_fail_test.htm Download (685 bytes) - added by gloddy 4 years ago.
test case for contains failure

Change History

Changed 4 years ago by gloddy

test case for contains failure

comment:1 Changed 4 years ago by gloddy

This bug can be deleted. I revisited the issue and found it was a syntax mistake. My apologies.

comment:2 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.