I have text from rusks that I use to open menu items on a page. For example, let's say bctext = 'pasta'.
I want to target the word "pasta" but not say "yadda yadda yadda pasta". Only a copy of the single word "pasta" must match, or if it bctextwas a phrase, then he will find only the exact phrase.
This is what I still have:
$('ul#accordion a:contains(' + bctext + ')')
But this, of course, finds "yadda yadda pasta".
I get bctextwith the following:
var bctext = $('#CategoryBreadcrumb ul li:last-child').prev().children().text();
Then I edit the menu with the following:
$('ul#accordion a:contains(' + bctext + ')').parent()
.addClass('special')
.children('ul')
.css('display','block');
Is this what I'm going to make possible?
source
share