From 70036952b458056f63a80c9740432a89353a6802 Mon Sep 17 00:00:00 2001 From: RameshT Date: Tue, 6 Aug 2024 14:50:56 +0530 Subject: [PATCH] Test Husky pre-commit hook. --- assets/js/updation.js | 129 ++++++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 60 deletions(-) diff --git a/assets/js/updation.js b/assets/js/updation.js index 3bd83e5..20d77af 100644 --- a/assets/js/updation.js +++ b/assets/js/updation.js @@ -1,34 +1,35 @@ -$(document).ready(function() { - let index = 1; - let activeSection = null; +$(document).ready(function () { + let index = 1 + let activeSection = null - function addOption(type, container) { - let optionHtml; - if (type === 'multiple-choice' || type === 'checkboxes') { - optionHtml = ` + function addOption(type, container) { + let optionHtml + if (type === 'multiple-choice' || type === 'checkboxes') { + optionHtml = `
+ ×
- `; - } else if (type === 'dropdown') { - optionHtml = ` + ` + } else if (type === 'dropdown') { + optionHtml = `
×
- `; - } - container.append(optionHtml); + ` } + container.append(optionHtml) + } - function createFormSection() { - let newSection = ` + function createFormSection() { + let newSection = `
-
- ${index === 1 ? '
' : ''} - +
+ ${index === 1 ? '
' : ''} + ' + ) + } else if (type === 'paragraph') { + container.append( + '' + ) + } else { + addOption(type, container) + $(this) + .closest('.form-section') + .append( + '' + ) } - - $('#add-section-btn').on('click', function() { - createFormSection(); - $('.form-section').removeClass('active'); - activeSection = $('.form-section').last(); - activeSection.addClass('active'); - positionAddSectionButton(); - }); - - $(document).on('change', '.custom-select', function() { - let type = $(this).val(); - let container = $(this).closest('.form-section').find('.options-container'); - container.empty(); - - $(this).closest('.form-section').find('.add-option-btn').remove(); - - if (type === 'short-answer') { - container.append(''); - } else if (type === 'paragraph') { - container.append(''); - } else { - addOption(type, container); - $(this).closest('.form-section').append(''); - } - }); - -}); \ No newline at end of file + }) +})