I'm trying to get a piece of jquery to work without success.

I'm using a link as the outermost structure so the element is in the
tab-able elements, but I seem to be running into trouble with a link's
default onmousedown or onmouseclick behaviors.

The jquery:

$("a").onmousedown(function(){
    $(this).css("background-color","red");
}).onmouseout(function(){
    $(this).css("background-color","blue");
});

The html:

<a href="#something">This link has an HREF</a><br>
<a>This link has no HREF</a>

The problem:

Clicking down on the first link changes its background color to red. 
Holding the mouse down and dragging the mouse off the link does not change
the color to blue.  Releasing the mouse button on or off the link does
change the background color to blue: a condition that only mouseout should
trigger.

Clicking on the second link and dragging off follows the desired behavior,
but because the link has no href attribute it is not in the tab train of the
page.

Has anyone else run into this problem before and found a solution where the
mousedown and mouseout behaviors both fire AND the element is
tab-targetable?

Much appreciated!
-- 
View this message in context: 
http://www.nabble.com/link-with-mouseout-after-mousedown-tf4938802s27240.html#a14137040
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to