Question: Assume that the following $() function is available: const $ = selector => document.querySelector(selector); For the following code, an event handler named investmentChange() is const
Assume that the following $() function is available: const $ = selector => document.querySelector(selector); For the following code, an event handler named investmentChange() is const investmentChange = () => { const years = parseInt($("#years").value); alert("Years: " + years); }; document.addEventListener("DOMContentLoaded", () => { $("#investment").addEventListener("change", investmentChange); });
A) attached to the DOMContentLoaded event of the document object
B) attached to the DOMContentLoaded event of an element with an id of investment
C) attached to the change event of the document object
D) attached to the change event of an element with an id of investment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
