Solved

Get element jquery

Posted on 2012-03-15
2
297 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

696 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