Home  >  Article  >  Web Front-end  >  How jQuery implements clicking on the page to obtain the id or other information of the currently clicked element_jquery

How jQuery implements clicking on the page to obtain the id or other information of the currently clicked element_jquery

WBOY
WBOYOriginal
2016-05-16 17:04:381234browse
Copy code The code is as follows:

$(document).click(function (e) {
var v_id = $(e.target).attr('id');
}

Copy code The code is as follows:

$(e.target)

After getting the current element, you can get the tag name, name and other attributes you want to control the click. Which tag triggers the event

js to determine whether a string contains another string

"ssssddd".indexOf("ss")>0
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn