views:

18

answers:

1

How to catch mouseover event on whitespaces (blanks between text words) in a div? The div can contain html also.

A: 

One way is to wrap the whitespaces in elements, for example:

<div>content here and whitespaces</div>
<!-- wraping... -->
<div>content<div class="whitespace"> </div>here<div class="whitespace"> </div>and<div class="whitespace"> </div>whitespaces</div>

Then you can use jQuery's live to bind an event.

$(".whitespace").live("mouseover", function(e){
    // This should do...
});
BrunoLM