2. Arrange the following words in a meaningful sequence: 1. Tree, 2. Seed, 3. Plant, 4. Fruit, 5. Flower
2, 3, 1, 5, 4
1, 2, 3, 4, 5
2, 3, 5, 1, 4
3, 2, 1, 5, 4
// Handle click to select/deselect options on radio button or label
document.querySelectorAll('.options label').forEach(label => {
const input = label.querySelector('input[type="radio"]');
label.addEventListener('click', (e) => {
e.preventDefault(); // Prevent default behavior
const questionId = label.closest('.question').id.split('-')[1];
const navButton = document.querySelector(`.question-nav button[data-question="${questionId}"]`);
if (input.checked) {
// Deselect if already checked
input.checked = false;
navButton.classList.remove('attempted');
if (!navButton.classList.contains('review')) {
navButton.classList.add('not-attempted');
}
} else {
// Select and uncheck others in the group
const radios = label.closest('.options').querySelectorAll('input[type="radio"]');
radios.forEach(radio => radio.checked = false);
input.checked = true;
if (!navButton.classList.contains('review')) {
navButton.classList.remove('not-attempted');
navButton.classList.add('attempted');
}
}
});
});
// Form submission
document.getElementById('mockTestForm').addEventListener('submit', function(e) {
e.preventDefault();
const answers = {
q1: document.querySelector('input[name="q1"]:checked')?.value,
q2: document.querySelector('input[name="q2"]:checked')?.value
};
alert('Test Submitted! Your answers: ' + JSON.stringify(answers));
});
// Initialize
showQuestion(currentQuestion);
Social Plugin