鑑於這種HTMLJQuery的選擇內div標籤
<div class="list">Item 1
<div class="hidden">This is the rest of the data</div>
</div>
,我需要選擇只有內div標籤的內容。
我有這個JQuery函數,但我似乎無法得到內部標記。
$(".list").click(function() {
var htmlString = $(this).html();
alert(htmlString)
});
嘗試使用.children()而不是.html() – 2015-03-24 22:57:56