Burak Özmen
Burak Özmen

Reputation: 873

How do I select a specific class under a specific id?

http://jsfiddle.net/d4NxZ/1/

Here is my code. I want to change the context in right frame when i click the buttons. But these line of codes don't seem like working. I think it is because of selectors, I tried different selectors but it was no use.

$('#web-dash').click(function(){
    $(".graphs-dash>div:visible").slideUp('1000', function() {
        $("#whole .websitestats").slideDown('1000');
        $('#pie').hide();
        $('#toShow').val("1");
    });
})

$('#skill-dash').click(function(){
    $(".graphs-dash>div:visible").slideUp('1000', function() {
        $("#whole .skill").slideDown('1000');
        $('#pie').hide();
        $('#toShow').val("1");
    });
})

How can I select #whole .skill and #whole .websitestats? I made google searchs about selectors but couldn't solve the problem.

Upvotes: 0

Views: 72

Answers (2)

M.G.Manikandan
M.G.Manikandan

Reputation: 993

Don't know whether I understood your issue correctly.

$("#whole .websitestats").slideDown('1000');

Even after executing above code .websitestats is not visible. Is this is you problem ?

$("#whole .websitestats") and $("#whole .skill") matches the respective elements correctly. But, display:none property is added in #whole div. As parent div is not visible child element also not visible.

Try

$("#whole").show().find(".skill").slideDown('1000');

Upvotes: 1

Rohan Kumar
Rohan Kumar

Reputation: 40639

Try this,

$('#web-dash').click(function(){
    $(".graphs-dash>div:visible").slideUp('1000', function() {
        $("#whole").find(".websitestats").slideDown('1000');// use find function here
        $('#pie').hide();
        $('#toShow').val("1");
    });
});
$('#skill-dash').click(function(){
    $(".graphs-dash>div:visible").slideUp('1000', function() {
        $("#whole").find(".skill").slideDown('1000');// use find function here
        $('#pie').hide();
        $('#toShow').val("1");
    });
})

Find Docs http://api.jquery.com/find

Upvotes: 0

Related Questions