How does jQuery get the id or other information of the currently clicked element by clicking on the page

  • 2020-03-30 01:17:20
  • OfStack

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

 
$(e.target) 

You get the tag name, the name that you want for the current element and you can control which tag you want to click to trigger the event

Js determines whether the string contains another string

"SSSSDDD. IndexOf (" ss") > 0

Related articles: