Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
-1
rated 0 times [  2] [ 3]  / answers: 1 / hits: 61151  / 13 Years ago, wed, march 30, 2011, 12:00:00

I'm trying to find the following node within a page:



<span class=dotted>Admin</span>


I've tried the following jQuery selectors, but neither seem to work in selecting the node:



$(.dotted span:contains('Admin')).css(color,red);
$(span:contains('Admin') .dotted).css(color,red);


What am I doing wrong?


More From » jquery

 Answers
8

This selector should do what you want.



$(span.dotted:contains('Admin'))


Remember you can chain Tag names with IDs and classes. Example



$(span#yourID)


OR



$(span.yourclass)


OR a mixture of the two



$(span#yourID.yourClass)

[#93010] Tuesday, March 29, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
patienceannel

Total Points: 674
Total Questions: 101
Total Answers: 101

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
patienceannel questions
Fri, Mar 11, 22, 00:00, 2 Years ago
Tue, Oct 20, 20, 00:00, 4 Years ago
Wed, Jul 24, 19, 00:00, 5 Years ago
;