www.webdeveloper.com
Results 1 to 3 of 3

Thread: how to get the id of the button that is clicked?

  1. #1
    Join Date
    Nov 2004
    Location
    Singapore
    Posts
    7

    Question how to get the id of the button that is clicked?

    Pls help! Is there anyway whereby we get the id of the button which user has clicked?

  2. #2
    Join Date
    Feb 2003
    Posts
    2,745
    Well, you could pass it to the script.

    Code:
    <input id="btn1" type=button onclick="someFunction(this.id)">
    ...
    function someFunction(elId){};
    I think this is IE only (someone correct me if I'm wrong) but:

    elementClicked = event.srcElement;
    idOfElementClicked = el.id;

  3. #3
    Join Date
    Oct 2004
    Posts
    1,118
    Pls help! Is there anyway whereby we get the id of the button which user has clicked?
    It's probably not necessary. What are you trying to do?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles