これが私が持っているコードです:
<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>
そしてJquery
$(function () {
$('a.clickMe').click(function () {
// find first of following DIV siblings
// with class "textBox" and toggle it
$(this).nextAll('div.sri:first').toggle();
});
});
Text1がクリックされたときに「このテキストはトグルされます」と表示し、「このテキストはトグルされます2」を非表示にすることで正常に動作していますが、反対の方法で動作させたい、つまり「このテキストはトグル」を表示し、Text1 をクリックすると「このテキストはトグル 2」と表示されます。これを修正するのを手伝ってください。