Contents

How can you programmatically set the value of a radio button in an HTML form using JavaScript?
a) radio. setValue();                           
b) radio. select();
c) radio. setAttribute ('checked', 'true');           
d) radio. checked = true;

d

Explanation:
To programmatically set the value of a radio button in an HTML form using JavaScript, you can use the statement "radio. checked = true;" where "radio" is the reference to the radio button element.


What is the purpose of the "focus ()" method in relation to HTML form elements?
a) It sets the focus on the first input field of the form.             
b) It validates the form fields before submission.

c) It changes the appearance of the focused input field.            
d) It prevents the form from being submitted.

a

Explanation:
The "focus ()" method in relation to HTML form elements is used to set the focus on the first input field of the form, making it ready for user input without the need for clicking on it.


Adding Menus To Forms:


Which HTML element is commonly used to create a menu in a form?
a) <menu>                           
b) <nav>
c) <ul>                                  
d) <form-menu>

c

Explanation: The <ul> element is commonly used to create a menu in a form. It is used along with <li> elements to represent the individual menu items.


What is the purpose of the "label" element when creating menus in forms?
a) It sets the background color of the menu items.      
b) It specifies the title of the menu.
c) It associates a label with a form control for accessibility. 
d) It adds a border around the menu.

c

Explanation: The "label" element, when creating menus in forms, is used to associate a label with a form control, providing better accessibility and usability for screen readers and other assistive technologies.


What is the purpose of the "disabled" attribute in menu items?
a) It hides the menu item from the display.  
b) It prevents the menu item from being selected or clicked.
c) It changes the appearance of the menu item.
d) The <menu> element does not have a "disabled" attribute.

b

Explanation: The "disabled" attribute in menu items is used to prevent the menu item from being selected or clicked, making it non-interactable and visually indicating that it is currently unavailable or inactive.