Search code examples
javascriptjqueryvarrel

jQuery: Show a DIV with a VAR as CLASS


I'm trying to link some DIVs together by putting the class of DIV#2 into REL of DIV#1.

I can't find out why this doesn't work. If I html() it, it will write the correct thing.

I have made an example on jsfiddle: http://jsfiddle.net/n6Q2G/6/

Can you see whats wrong???


Solution

  • Is this what you're looking for? http://jsfiddle.net/jomanlk/n6Q2G/7/

    I changed it to $("div." + sucessDialog).show();

    $('.submit').click(function() {
        var sucessDialog = $('#dialogs > div:visible').attr('rel');
        $('#dialogs > div:visible').slideUp("slow");
    
        //just do a filter with divs that have that added class
        $("div." + sucessDialog).show();
    });