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
Get step-by-step solutions from verified subject matter experts
