using a variable in :contains - how to
问题 I am using accordion menu on an e-commerce site. The menu stays open with the options until the product page. On that page I am trying to use the breadcrumbs to match text in the menu and then apply a class to open the menu to the correct category for the page. Here is my code: $(document).ready(function(){ var bctext = $('#ProductBreadcrumb ul li:last-child').prev('li').children().text(); $('ul#accordion a:contains(bctext)').parent().parent().addClass('special'); }); The variable returns the