Hi

someone can tell me why 4th line isn't working ?

$('span').on('click', function(){
var name=$(this).attr("class");

$(name).click(function(){
    $("#chatwindow").toggle("#hide");
});
Member Avatar

name is going to be whatever is in the class attribute (which could look like this class="class1 class2 class3"). Below will work if there is only one class assigned to the attribute:

$('.' + name).click(function(){

});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.