jquery Gets the id attribute value of the clicked element

Source: Internet
Author: User

jquery Gets the id attribute value of the clicked element:
Sometimes it may be necessary to get some information of the clicked element, this chapter takes the id attribute as an example to demonstrate, of course, in the actual application may not be so simple, but the complex function is composed of small functions, the following through the example code to do a brief introduction.
The code is as follows:

$ (document). Click (function  (e) {   var v_id=e.target.id;})

Related reading:
1.click events See The Click event section of jquery .
The 2.target attribute can be found in the Event.target Properties section of jquery .
The 3.attr () function can be found in the attr () method section of jquery .

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=11637

For more information, refer to: http://www.softwhy.com/jquery/

jquery Gets the id attribute value of the clicked element

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.