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