Current location - Quotes Website - Personality signature - Ask how to use jquery to get the XPATH path of the tag clicked on the web page.
Ask how to use jquery to get the XPATH path of the tag clicked on the web page.
Maybe so. You can try.

Jquery has a. parents ().

For example, if you choose a div id as test, if you want to complete xpath, $("#test "). Parents (); What you get is an array,

var aa =[];

$('#test ')。 Parents (). each(function(){

aa . push(this . tagname);

});

After you get the tag name, you can replace it with xpath, but pay attention to the fact that the last element of the body should be html. You are not sure. Anyway, it's like this on Firefox.