好的功能,所以我得到如何使用屬性,現在我想要做的,是爲jQuery找到屬性即時通訊使用和使用它只一次打開一個評論框使用jQuery來查找一個屬性,然後只做基於屬性
HTML:
<div class="commentopen" id="1">Comment</div>
<div class="comment" id="1"><textarea>write a comment...</textarea></div>
<div class="commentopen" id="2">Comment</div>
<div class="comment" id="2"><textarea>write a comment...</textarea></div>
<div class="commentopen" id="3">Comment</div>
<div class="comment" id="3"><textarea>write a comment...</textarea></div>
我有類.comment display: none;
的jQuery:
$('.commentopen').click(function() {
var id = $(this).attr('id');
$(".comment" + id).slideDown(180, function() {
$('#container').isotope('reLayout');
});
});
我真的可以使用一些幫助,爲什麼它不工作。一直在爲此工作好幾天!
ID應該[HTML文檔中是唯一的(http://www.w3.org/TR/html5/elements.html #在-ID屬性)。你應該重新考慮你的方法。 – Andrew 2012-03-26 15:40:37
圍繞生產中的這段代碼,你有一個document.ready()嗎?此外,像我之前的幾個,小心ID,也許使用您的意見,而不是數據ID ... – jcreamer898 2012-03-26 15:41:14
即時通訊使用MySQL來獲取評論ID的不同職位。 – 2012-03-26 15:46:44