Solved

Get element jquery

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
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)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 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