Sam
Sam

Reputation: 4487

Equivelant of blur for non-form elelments

Here's my non-working example to demonstrate the kind of thing i'm looking for.

http://jsfiddle.net/h2cQ6/2/

Any suggestions?

Upvotes: 0

Views: 222

Answers (3)

Kevin Bowersox
Kevin Bowersox

Reputation: 94469

You need to add a tabindex to the div.

<div style="height: 100px; width: 100px; background: red;" tabindex=0></div>

Then it should work

http://jsfiddle.net/h2cQ6/5/

Click in the box and hit tab tab

Upvotes: 2

Jivings
Jivings

Reputation: 23250

I think you want mouseout.

$(function(){
   $('div').mouseout(function(){
       alert('Foo!')
   })
})

http://jsfiddle.net/h2cQ6/3/

Upvotes: 0

Scott
Scott

Reputation: 2793

I'm on a phone so can't see your example, but what's stopping you from using click, mouseover, etc.? Those events work on any element.

Upvotes: 0

Related Questions