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 for stbuchok

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.