$(hàm(){ var e = document.forms[0]; var numQuestion; var i; var formName = $(this).e; for(i = 0; i < e.length; i++){ numQuestion = e.getEle**mentsByTagName('label'); console.log(numQuestion.length); }
// --- when user changes a checkbox --- $(document).on('change', 'input[type="checkbox"]', function(e) { // --- get the form name --- var $form = $(this).closest('form'); var formName = $form.attr('id');
// --- count the checkboxes for this form --- var totalCheckboxes = $form.children('input[type="checkbox"]').length;
// --- place count value in the 'numOfQuestions' p --- var $panel = $form.closest('.panel-default'); $panel.find('.numOfQuestions').text('/' + totalCheckboxes);
// --- count total checkboxes checked --- var countCheckedCheckboxes = $form.children('input[type="checkbox"]:checked').length;
// --- place checked count in 'count-checked-checkboxes' p --- $panel.find('.count-checked-checkboxes').text('Name of Section '+countCheckedCheckboxes);
Tôi là một lập trình viên xuất sắc, rất giỏi!