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