我試圖做一個簡單的slideToggle當一個錨點標籤被點擊。應該滑動的文本被封裝在直接在錨標籤之後編碼的span標籤中。我想是這樣的,但它沒有工作:jquery這個選擇然後下一個
<script>
$('#rp-help-main a').click(function() {
$(this).next().find("span").slideToggle('slow', function() {
// Animation complete.
});
});
</script>
下面是一個簡單的html:
<div id="rp-add-note">
<h4>Add note tool</h4>
<p>
This tool allows you to <strong>add a note</strong> anywhere in your room. Simply move your cursor to where you'd like your note to appear and left-click.<a href="#" onclick="return false">expand more</a> <span>A text box will appear. Once you type your note choose SAVE and your note will be inserted directly into your room.
<br /><br />
Move your note using the selection tool. Simply click on the note and drag it where you'd like it to appear. To delete, click on the note to view the text box again. Once the text box appears, click REMOVE TEXT
</span>
</p>
</div>
<div id="rp-undo-tool">
<h4>Undo tool</h4>
<p>
Click on this button at any time to <strong>undo your last action</strong>. Note: This will only undo your last action, it will not... <a href="#" onclick="return false">expand more</a> <span>continue to undo previous actions.
</span>
</p>
</div>
爲了獲得更好的效果,請界定「不工作」。 –