Hi
How to display multiple options as parameter . I want with checkbox. If User select Original , Duplicate then on first Copy Original should get displayed & on next Duplicate
Original
Duplicate
Triplicate
Thanks
Hi
How to display multiple options as parameter . I want with checkbox. If User select Original , Duplicate then on first Copy Original should get displayed & on next Duplicate
Original
Duplicate
Triplicate
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Deepak RawatRank #646 · 3.7K reputationPosted Jul 31, 2023, 1:00 AM EDT
Here we have two checkboxes (Original and Duplicate) and two corresponding div elements with class "option-content" representing the content that should be displayed when each option is selected. Initially, both content divs are hidden using CSS (display: none). When a checkbox is clicked, the showContent() function is called. This function hides both content divs and then shows the appropriate one based on the selected checkbox values. If the "Original" checkbox is checked, the "OriginalContent" div will be displayed. If the "Duplicate" checkbox is checked, the "DuplicateContent" div will be displayed.
Display Multiple Options with Checkboxes .option-content { display: none; } Select Options: Original Duplicate This is the Original content. This is the Duplicate content. function showContent() { const options = document.querySelectorAll('input[name="option"]'); const originalContent = document.getElementById('OriginalContent'); const duplicateContent = document.getElementById('DuplicateContent'); originalContent.style.display = 'none'; duplicateContent.style.display = 'none'; options.forEach(option => { if (option.checked) { if (option.value === 'Original') { originalContent.style.display = 'block'; } else if (option.value === 'Duplicate') { duplicateContent.style.display = 'block'; } } }); }