Tarida George
Tarida George

Reputation: 1303

Show div one by one jquery

Hi I have 4 divs with same class 2 of them (first and second are display) the other are hide using $('.smt:gt(1)').hide();

<div class="smt"><p>1</p></div>
<div class="smt"><p>2</p></div>
<div class="smt"><p>3</p></div>
<div class="smt"><p>4</p></div>
<div id="more"><p>+</p></div>

How can I show the other div one by one clicking on more div?

Upvotes: 0

Views: 231

Answers (1)

wirey00
wirey00

Reputation: 33661

try this

$('#more').click(function(){ // <-- bind click event to more
    $('.smt:hidden').eq(0).show(); // <-- show first hidden div with class .smt
    // or $('.smt:hidden').first().show();
    // or $('.smt:hidden:first').show();
    // or $('.smt:hidden:eq(0)').show();
});

Upvotes: 2

Related Questions