getting all attributes and values of an element
getting all attributes and values of an element
by Akram kamal
HTML
<div class='my_firstClass my_secondClass' data='my_data' myCustomAttr="my_custAttr">test</div>
JavaScript
$(function() {
$("div").each(function() {
$.each(this.attributes,function(i,a){
console.log(i,a.name,a.value)
})
})
})