Explain how you can work with radio buttons and check boxes.
What will be an ideal response?
Option or radio buttons are grouped by a common field name placed within thefollowing array:options[idref]whereoptionsis the common field name used by all the option buttons and idref iseither the index number or ID of the option button. For example, the first option buttonfor the protection field from the customer order form would have the following reference:document.forms.orderForm.elements.protection[0]?To determine which option button has been checked by the user, you have toexamine the checked property of each button. For example, the following code uses aforloop to go through each option button associated with the protection field, storingthe value of the selected option in the pCost variable, and breaking off theforlooponce the checked button has been located:var orderForm = document.forms.orderForm;var protection = orderForm.elements.protection;for (var i = 0; i < protection.length; i++) {if (protection[i].checked === true) {var pCost = protection[i].value;break;}}?Check box controls work the same way as option buttons in which thecheckedproperty indicates whether the box is checked and the value associated with achecked box is stored in thevalueproperty of the check box object. However, thisvalue is applied only when the check box is checked; otherwise there is no field valueassociated with the element.