jQuery Extract Year from Date and Add Class to Parent
问题 I'm looking to create an isotope filter to a div list and as such want to add a class of the year to a parent container/div by extracting the 'Year' from a displayed date and then adding that as the class to the parent div ( .publication ) Right now I am using a very basic method to do this by looking to see if a div contains a specific year and then individually assigning a year: HTML <div> <div class="publication addyearclasshere"> <div class="publication-date">15/3/2017</div> </div> <div