Answers for "get all data attributes jquery from multiple elements"

0

get all data attributes jquery from multiple elements

var allAttributes = jQuery('.class').map(function() { /* example: .class */
  return jQuery(this).data('id'); /* example: id */ 
}).get();

/* Returns all attributes witin an array like: ["1", "2", "3", "4"] */
console.log(allAttributes);
Posted by: Guest on May-24-2020

Code answers related to "get all data attributes jquery from multiple elements"

Code answers related to "Javascript"

Browse Popular Code Answers by Language