Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

How can you get the value of an input field?

View

Which property is used to set or get the checked state of a checkbox?

View

How can you set the disabled attribute on a button?

View

Which method would you use to reset a form to its initial values?

View

How can you dynamically change the action attribute of a form?

View

What does the onchange event do for an input element?

View

How can you add a new option to a <select> element?

View

Which method can be used to remove a specific option from a <select>?

View

How can you prevent the default submission of a form?

View

What happens if you call form.submit(); programmatically?

View

How can you get the value of an input field?

inputElement.getValue();
inputElement.value;
inputElement.innerHTML;
inputElement.textContent;

Which property is used to set or get the checked state of a checkbox?

checkbox.checked
checkbox.isChecked
checkbox.value
checkbox.status

How can you set the disabled attribute on a button?

button.disabled = true;
button.setAttribute('disabled', 'true');
Both a and b
button.disable();

Which method would you use to reset a form to its initial values?

form.reset();
form.clear();
form.initialValues();
form.restore();

How can you dynamically change the action attribute of a form?

form.action = 'newAction.php';
form.setAttribute('action', 'newAction.php');
Both a and b
form.changeAction('newAction.php');

What does the onchange event do for an input element?

Triggers when the element loses focus
Triggers when the value of the element changes
Triggers when the element is clicked
Triggers when the form is submitted

How can you add a new option to a <select> element?

selectElement.add(newOption);
selectElement.appendChild(newOption);
selectElement.options.add(newOption);
selectElement.insert(newOption);

Which method can be used to remove a specific option from a <select>?

selectElement.removeChild(option);
selectElement.remove(option.index);
selectElement.options.remove(option.index);
Both b and c

How can you prevent the default submission of a form?

event.preventDefault();
return false;
Both a and b
None of the above

What happens if you call form.submit(); programmatically?

It triggers the form's onsubmit event
It submits the form to the server
It prevents any validation
All of the above