Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript easiest way to get second parent

// If you want to target the parent by tagName you could use .closest(selector); like :
var x = document.getElementById("myLI").closest('section');
// NOTE : Take a look to the Browser compatibility section.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #easiest #parent
ADD COMMENT
Topic
Name
8+2 =