[jQuery] Re: :contains - a bit more specific?

2007-06-12 Thread MrNase

Thanks Erik, it works great! :)

 $('div.commentfooter  span').filter(function() { return $(this).html() ==
 'test'; }).append('class');


---dominik



[jQuery] Re: :contains - a bit more specific?

2007-06-11 Thread Erik Beeson

You could always use a filter function (untested):

$('div.commentfooter  span').filter(function() { return $(this).html() ==
'test'; }).append('class');

But you may find it easier to give the spans in question a class so you can
select them by class instead. SGML type markups seem to generally prefer
selection/manipulation by markup instead of by content.

--Erik

On 6/11/07, MrNase [EMAIL PROTECTED] wrote:



I have some layers, each of this layers has a span tag with a
username. Now, I want to append some code to each layer that has a
span which contains 'test'.

The code I tried is:

$(div.commentfooter[span:contains('test')]).append('class');


But that also appends 'class' to layers that have a span tag
containing 'testman' or 'tester'.

What do I need to change to only select those layers that have a span
tag that contains the word 'test' and only this word?

$(div.commentfooter[span:is('test')]).append('class');

doesn't work. :-(


---dominik