Solved

Get element jquery

Posted on 2012-03-15
2
293 Views
Last Modified: 2012-03-15
Hi

i have html like below. When the anchor tag is hovered i want to change the th background.
How can i target the th?

(There are several rows so i need to use $this rather than just using the id )

i tried $(this).prev("th") but no joy

 <th colspan="3" width="100%" id="course-title">
  <span><a id="title" href=""><?=$title?></a></span>
</th>
0
Comment
Question by:coolispaul
2 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 37726798
$(this).parent().parent().css("background-color","red");
0
 
LVL 82

Expert Comment

by:leakim971
ID: 37726834
$(this).closest("th").css("background-color","red");

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now