aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes distinguish between a click on the background of an element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "distinguish between a click on the background of an element" Watch "distinguish between a click on the background of an element" New topic
Author

distinguish between a click on the background of an element

Pesho Petrov
Greenhorn

Joined: Nov 20, 2007
Posts: 2
hello,

I have the following problem here - in my HTML I have a LI tag, which holds other tags inside(img div-s, hyperlinks).
My desire is to call a JavaScript function, but only when the background of LI is clicked. For example if a link within the LI tag is clicked, then the corresponding link is followed.

I tried adding the function directly in the LI but then it executes no matter what I click within this tag.


Please let me know if it's possible to isolate only the background clicks.

Thanks!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
look into using cancelBubble of the links and other things inside the element.

Eric
Pesho Petrov
Greenhorn

Joined: Nov 20, 2007
Posts: 2
thank you Eric,

This was exactly what I was looking for ! ! !


many thanks,
Pesho
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: distinguish between a click on the background of an element
 
Similar Threads
CSS not working in Firefox, works in IE
Problem with nullified CSS hover effect
Facing problem when I am mixing struts and AJAX
jQuery -- add remove list item
HTML drop downs not working