views:

96

answers:

2

Hello

<div><img src="truc.png" /> Chouette</div>

I'd like to mouseoverize the div but not the img

$('div').mouseover(go_truc);

How can I do that ?

A: 

Handle the mouseenter event, but do nothing if ($(e.target).is('img')).

Then, handle the <img> element's mouseenter event, and undo the effect.

SLaks
Putting a return(false) at the end of the img.mouseover fonction ?Is it the best solution ?
Glide
A: 

With

function do_trucs() {
  ...
}

function do_machins() {
  ...
  return (false);
}

$('div').mouseover(do_trucs);
$('div img').mouseover(do_machins);

It's working, but is it the simplest/best solution ?

(Anyway I need to handle the img.mouseover for other purpose)

Glide