Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Get element jquery

Posted on 2012-03-15
2
Medium Priority
?
307 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 2000 total points
ID: 37726798
$(this).parent().parent().css("background-color","red");
0
 
LVL 83

Expert Comment

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

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

580 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