Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

distinguish between a click on the background of an element  RSS feed

 
Pesho Petrov
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look into using cancelBubble of the links and other things inside the element.

Eric
 
Pesho Petrov
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Eric,

This was exactly what I was looking for ! ! !


many thanks,
Pesho
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!