Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript target closest class

// By Class (.)
var closestNextClass = document.getElementsByClassName('div-id-goes-here').closest(".div-class-here");

// By ID (#)
var closestNextId = document.getElementById('div-id-goes-here').closest("#div-class-here");
 
PREVIOUS NEXT
Tagged: #javascript #target #closest #class
ADD COMMENT
Topic
Name
9+7 =