Okay I still see the problem with that.

I need to get the color without currently hovering over it.

I did a test where I set an onclick event to return the color of the
link.
It returns the hover color when your mouse is over but not when you
don't.

<script type="text/javascript">
$('.testMe a').click(function(){
alert($(this).css('color'));
});
$('.testMe a').click();
</script>
<style type="text/css">
.testMe a:hover{
        color:#FF6633;
}
</style>
<div class="testMe">
<a>W3Schools 2</a>
</div>


On Sep 2, 4:57 pm, Dale Larsen <dalelarse...@gmail.com> wrote:
> Well, it works. I am not sure why my first implementation wasn't
> working.
>
> Thank you for your help!
>
> Kind regards,
> Dale Larsen
>
> On Aug 25, 6:04 am, Satyakaran <satyaka...@gmail.com> wrote:
>
> > I think you need to change your approach.
> > :hover is not set-able by jquery .....
>
> > I tried this
>
> > <script>
>
> > function hover1() {
>
> > var h = $(':hover', '.test');
>
> > $.each(
> > h,
> > function( intIndex, intVal ){
> >           alert($(this).css('color'))
> >         }
> > )
>
> > }
>
> > </script>
>
> > <div class="test">
> > <a href='http://www.w3schools.com/'onclick="alert($('.test
> > a:hover').css('color'));return false;">W3Schools1</a>
> > <a href='http://www.w3schools.com/'onclick="alert($('a:hover').css
> > ('color'));return false;">W3Schools2</a>
>
> > <a href='http://www.w3schools.com/'onclick="javascript:hover1
> > ();return false;">W3Schools3</a>
> > </div>
>
> > Here on link 1 and  2 , I am getting the right output but not through
> > a function I have tried in 3 link.
>
> > On Aug 25, 4:57 am, Dale Larsen <dalelarse...@gmail.com> wrote:
>
> > > I need to get the css hover color of an element. Since hover is a
> > > pseudo class of a class or id, I do not see a way of returning the
> > > color.
>
> > > I tried:
>
> > > $('.contentArea a:hover').css('color');
>
> > > but it does not return the hover color.
>
> > > I understand that jQuery probably traverses the inline styles and
> > > there is no way to set the hover  pseudo class inline, hence the
> > > reason for the .hover function.
>
> > > Is it possible to find and return the hover color with jQuery. If so
> > > how?

Reply via email to