IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes Get the ID of an element clicked on Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Get the ID of an element clicked on" Watch "Get the ID of an element clicked on" New topic
Author

Get the ID of an element clicked on

Keith.P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 339
Hi guys

I have a snippet of JS here which I would have expected to return the ID of the element for example say <image id='myImgTag'> I have clicked on, but for some reason it returns [ID:] where's I'd expect (hope) for something like [ID:myImgTag].



Any most likely obvious reasons this does not work and if possible, how do I get it to work?

Cheers in advance



Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
How are you calling getClickElement?

Eric
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

Event handling, and just about everything else, is so much easier when you use jQuery to factor away all the IE-proprietary nonsense:



Life is too short to fuss around with if (IE this) if (IE that) and so on...


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
IntelliJ Java IDE
 
subject: Get the ID of an element clicked on
 
Threads others viewed
Invoking functions in Javascript
Please help me analyze this script
"Edit in Place" Using Simple JS
Function call doubt
Absolute div dynamically appended to body element
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture