First of all, in this: $('ul#list_container a:contains(hidden_div)')
The word 'hidden_div' is just a string literal - ie it's just looking for the word hidden_div. If you want to look for the text you've assigned to the _variable_ hidden_div you just need to go: $('ul#list_container a:contains(' + hidden_div' + )') That may or may not be the best way of doing it, but I think it is what you intended to write. On May 1, 6:00 am, Wes Duff <[EMAIL PROTECTED]> wrote: > Does anyone know a work around or how to add a value to :contains. > Here is my code I am working with > > $('.printer_element > h2').each(function (i) { > if($(this).nextAll().size() > 0) { > //do nothing > } else { > //Here we hide the whole div from the browser. We use > display none > so the divs below the hidden div can move up into the next higher > position > $(this).parent().css({ display:"none"}); > //next we need to hid the checkbox and link in the > page layout for > the hidden printer_element > //first we asign the name of the hidden > printer_element to a > variable > var hidden_div = $(this).text(); > //Now we select the link of the corresponding text > and remove it > $('ul#list_container > a:contains(hidden_div)').remove(); > } > }); > > I would like to use hidden_div variable inside of they :contains() > when searching through my links > I would like to do this dynamicaly but it looks like I might have to > write redundant code to check all of my links. > > Thanks for the help.