How to know the names of all attributes of an element?

    1 answer 1

    You can do this:

    var arr = $("#someID")[0].attributes; //var arr = document.getElementById("someID").attributes; for(var i in arr) alert(arr[i].nodeName) 

    arr[i].nodeValue - their values

    UPD:

    Better this way. Arr is, it turns out, an object.

     while(arr[i].nodeName){ alert(arr[i].nodeName) i++; }