Question: Consider the following JS code: const $ = selector => document.querySelector(selector); document.addEventListener(DOMContentLoaded, () => { $(#ship_button).addEventListener(click, evt => { evt.preventDefault(); alert(evt.currentTarget.value); }); alert(Welcome to the

Consider the following JS code: const $ = selector => document.querySelector(selector); document.addEventListener("DOMContentLoaded", () => { $("#ship_button").addEventListener("click", evt => { evt.preventDefault(); alert(evt.currentTarget.value); }); alert("Welcome to the Calculate Cost page"); }); What happens as soon as the page that contains the code loads?

A) It displays a dialog box that displays "Welcome to the Calculate Cost page".

B) It displays a dialog box that displays the text of the HTML element with an id of ship_button.

C) It displays both dialog boxes.

D) It displays neither dialog box.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!