For this problem, consider the HTML code on the last page, which produces a web page that appears below: see image.

On the next page, write the missing JavaScript code so that, when the button is pushed, your JavaScript should take the string typed into the Sale Item box (e.g. apples) and have it appear in a formatted message at the bottom of the page. In particular, the item should be capitalized (e.g. APPLES) and then formatted according to the selected radio button. Following the formatted sale item, your code should append the text on sale here!. Below is an example, of how apples should appear when the Bold button is selected. see image.

On the next page, provide the JavaScript code that would be needed to perform this task. Here are some hints to help you:

  • Use the < strong> and < em> tags to format your item in bold and italics, respectively.
  • The following code returns true if the radio button with id of myButton is checked: document.getElementById('myButton').checked
  • The method toUpperCase() will takes a string and return a new string all capitalized. For example, if word has the value of cat, then word.toUpperCase() produces the string CAT.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.