javascript - How to find active tag formats using jQuery? -


i have situation sample code follows:

<html>   <head>     <title>untitled document</title>   </head>   <body>     <p>       <h1>the header</h1>       <div>         matter ia matter matter ia <strong>bold matter</strong> matter matter <em>italics matter</em>matter ia <em><strong>bold italics matter</strong></em>lways matter       </div>     </p>   </body> </html> 

i trying retrieve specific tags body->p->div->em->strong when click on "bold italics matter" using jquery. there standard method retrieve per click event?

if wan tag name of element clicked, can use:

$('*').click(function(e) {     e.stoppropagation();     console.log($(this).prop('tagname'));     }); 

fiddle demo


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -