Here is the code i have:
<a class="clickMe">Text 1</a>
<br />
<div class="sri"> - This text will be toggled</div>
<a class="clickMe">Text 2</a>
<br />
<div class="sri"> - This text will be toggled 2</div>
and the Jquery
$(function () {
$('a.clickMe').click(function () {
// find first of following DIV siblings
// with class "textBox" and toggle it
$(this).nextAll('div.sri:first').toggle();
});
});
now it’s working fine by displaying ‘This text will be toggled’ and by hiding ‘This text will be toggled 2’ when Text1 is clicked, but i want it work in the oppsite way, that is,
it should hide ‘This text will be toggled’ and display ‘This text will be toggled 2’ when Text1 is clicked.
Please help me to fix this.
why need extra classes this will solve your question
live demo