Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
 
PREVIOUS NEXT
Tagged: #data #attributes #jquery #multiple #elements
ADD COMMENT
Topic
Name
8+3 =