I am curious why I need this index
$(document).ready(function() {
$(".divToggle").each(function(index){
var buttonId = $(this)[0].attributes["id"].value.toString();
var idParts = buttonId.split('_');
var uniquePart = idParts[0] + "_" + idParts[1] + "_" + "divContentPanel";
$(this).click(function() {
$("#" + uniquePart).toggle("slow");
});
});
});
Why do I need the "[0]" in "var buttonId = $(this)[0]…" Without it, I get an attributes["id"] is null error..