Jquery – Another jquery :not selector question

jqueryselector

The :not always gives me such headache. I am trying to not repeat an addition of plus sign. This is the selector that gives me the element I want:

#submenu li.current_page_ancestor.current_page_parent a:first

Basically I want to say that if that selector does NOT already have a plus in front of it, add it. But where do i put the :not and the various contains? I've tried this, which didn't work:

$j('#submenu li.current_page_ancestor.current_page_parent a:first:not('contains("+")')).prepend("+ ");

thanks so much! (also, if anyone can recommend a way to not use :not, and use ! instead, that would be spectacular!)

Best Solution

try $j('#submenu li.current_page_ancestor.current_page_parent a:first:not(contains("+"))').prepend("+ ");