$(".menu dt a").click(function() {
var clickedId = "." + this.id.replace(/^link/,"ul");
In the second line above, I want to replace id with class,
I tried
var clickedId = "." + this.attr("class").replace(/^link/,"ul");
But the code above doesn't worked and showed me the following error in console
this.attr is not a function
Any hints how can I use a class instead of id ?
$(this), notthisto have a jQuery object.thisis a DOM elementthisas an jquery object$(this)instead