Solved

Get element jquery

Posted on 2012-03-15
2
292 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
Comment Utility
$(this).parent().parent().css("background-color","red");
0
 
LVL 82

Expert Comment

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

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

762 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

12 Experts available now in Live!

Get 1:1 Help Now