[英]How can i pass the variable inside the tag through .html() jquery method?
這是示例代碼:
$('#button1').click(function () {
var result = $('input[type="checkbox"]:checked');
var numbers = result.length;
$('div[class="new"]').html('<h1>numbers</h1>');
});
我想在其中顯示不同標簽內的所有變量。 現在我只在DOM上獲取數字作為輸出? 如何獲得DOM中數字的值?
簡單的字符串連接
$('div[class="new"]').html('<h1>' + numbers + '</h1>');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.