Skip to main content
added 159 characters in body
Source Link
FishBasketGordo
  • 23.1k
  • 4
  • 59
  • 92

iI have a result ofsome text from a breadcrumb which iI am using to open menu items with on a page. say For example, say the bctext = pastabctext = 'pasta'.

so then iI want to target the word pasta"pasta", but not say "yadda yadda yadda pasta". onlyOnly an instance of the single word pasta."pasta" should match, or if bctextbctext were a phrase.., then it would only find the instance of the exact phrase.

right now with the followingThis is what I have so far:

$('ul#accordion a:contains(' + bctext + ')')

i getBut this finds "yadda yadda pasta" too., of course.

is this possible?

edit: iI get the bc textbctext with the following:

var bctext = $('#CategoryBreadcrumb ul li:last-child').prev().children().text();

then iThen, I edit the menu with the following:

$('ul#accordion a:contains(' + bctext + ')').parent()
                                            .addClass('special')
                                            .children('ul')
                                            .css('display','block'); 

Is what I'm going for possible?

i have a result of text from a breadcrumb which i am using to open menu items with on a page. say the bctext = pasta.

so then i want to target the word pasta, but not say "yadda yadda yadda pasta". only an instance of the single word pasta. or if bctext were a phrase.. then it would only find the instance of the phrase.

right now with the following:

$('ul#accordion a:contains(' + bctext + ')')

i get "yadda yadda pasta" too. of course.

is this possible?

edit: i get the bc text with 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'); 

I have some text from a breadcrumb which I am using to open menu items on a page. For example, say the bctext = 'pasta'.

I want to target the word "pasta", but not say "yadda yadda yadda pasta". Only an instance of the single word "pasta" should match, or if bctext were a phrase, then it would only find the exact phrase.

This is what I have so far:

$('ul#accordion a:contains(' + bctext + ')')

But this finds "yadda yadda pasta", of course.

I get the bctext with 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 what I'm going for possible?

added 307 characters in body
Source Link
liz
  • 483
  • 1
  • 7
  • 16

i have a result of text from a breadcrumb which i am using to open menu items with on a page. say the bctext = pasta.

so then i want to target the word pasta, but not say "yadda yadda yadda pasta". only an instance of the single word pasta. or if bctext were a phrase.. then it would only find the instance of the phrase.

right now with the following:

$('ul#accordion a:contains(' + bctext + ')')

i get "yadda yadda pasta" too. of course.

is this possible?

edit: i get the bc text with 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'); 

i have a result of text from a breadcrumb which i am using to open menu items with on a page. say the bctext = pasta.

so then i want to target the word pasta, but not say "yadda yadda yadda pasta". only an instance of the single word pasta. or if bctext were a phrase.. then it would only find the instance of the phrase.

right now with the following:

$('ul#accordion a:contains(' + bctext + ')')

i get "yadda yadda pasta" too. of course.

is this possible?

i have a result of text from a breadcrumb which i am using to open menu items with on a page. say the bctext = pasta.

so then i want to target the word pasta, but not say "yadda yadda yadda pasta". only an instance of the single word pasta. or if bctext were a phrase.. then it would only find the instance of the phrase.

right now with the following:

$('ul#accordion a:contains(' + bctext + ')')

i get "yadda yadda pasta" too. of course.

is this possible?

edit: i get the bc text with 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'); 
Source Link
liz
  • 483
  • 1
  • 7
  • 16

jquery find exact string with no more or less

i have a result of text from a breadcrumb which i am using to open menu items with on a page. say the bctext = pasta.

so then i want to target the word pasta, but not say "yadda yadda yadda pasta". only an instance of the single word pasta. or if bctext were a phrase.. then it would only find the instance of the phrase.

right now with the following:

$('ul#accordion a:contains(' + bctext + ')')

i get "yadda yadda pasta" too. of course.

is this possible?