Html code generator

MCQ Quiz Code Generator

MCQ Quiz Code Generator

Add questions (up to 150), then generate copy-paste HTML for your website/WordPress.

Max: 150 questions
Questions: 0
Fill the question, 4 options, and choose the correct answer.

Generated Quiz Code (copy & paste into your site)

WordPress: use a Custom HTML block, then click Preview (scripts don’t run inside the editor pane).

`; } // --- Event bindings --- addBtn.addEventListener('click', addQuestion); generateBtn.addEventListener('click', () => { const { valid, data } = collectQuestions(); if (!valid) return; output.value = generateStudentQuizHTML(data); showToast('Quiz code generated!'); output.scrollIntoView({ behavior: 'smooth', block: 'center' }); }); copyBtn.addEventListener('click', async () => { if (!output.value.trim()) { showToast('Nothing to copy. Generate code first.', 'rose'); return; } try { await navigator.clipboard.writeText(output.value); showToast('Copied to clipboard!'); } catch { output.select(); document.execCommand('copy'); showToast('Copied!'); } }); // Start with one empty question so you can see it immediately addQuestion(); // Remove button via event delegation (cards are dynamic) container.addEventListener('click', (e) => { const btn = e.target.closest('.removeBtn'); if (!btn) return; btn.closest('.q-card')?.remove(); renumber(); }); });
Scroll to Top