<div class="box">
<span class="test"></span>
</div>
<div class="row"></div>
<input type="button" value="Add" id="button">
<style type="text/css">
.box {
display: none;
}
</style>
上述股利是不可見的,當頁面加載。點擊按鈕後,我們可以看到div。現在我想追加文本跨度當div是可見的。jQuery的文本添加到跨過當DIV可見
$('#button').on("click",function(e){
e.preventDefault();
$('.box').clone().show().append('.row');
});
我想這
1) $(".box").closest(".test").text("hello");
2) $(".box").find(".test").text("hello");
但它不添加文本跨度。
嘗試'$( 「箱子 」)查找文本( 「你好」)。(「 測試」);' –
@KartikeyaKhosla使用find不工作。 – rajesh
使用'.clone()'的目的是什麼? – Satpal