I am quite new to programming and have to generate a Xpath on clicking an html element. for example :if i have clicked on text box of username then it should give me the xpa
This could help you
fiddle
$('p').click(function(){ parentEls = $(this).parents() .map(function () { return this.tagName; }) .get().join(", "); alert(parentEls); });