I have a situation where I need to search multiple "li" s each for a certain different string, and if it meets the conditions in all of them, append a link to only the last one.
I am using jQuery :contains()
to find out if each li has a certain word in it, and i can make it .append()
to all of the li's based on the multiple conditions, but I only need it to append to the last li.
How do I get that to work? I can get it to append to all using:
$('li#1:contains("x"),li#2:contains("y")').append('z');
this gives me:
xz
yz
I need it to only give me:
x
yz