Pre-Summer Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: validbest

Exam JavaScript-Developer-I All Questions
Exam JavaScript-Developer-I All Questions

View all questions & answers for the JavaScript-Developer-I exam

Salesforce Developer JavaScript-Developer-I Question # 62 Topic 7 Discussion

JavaScript-Developer-I Exam Topic 7 Question 62 Discussion:
Question #: 62
Topic #: 7

A developer creates asimple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayedin the console.

Here is the HTML file content:

<input type =” text” value=”Hello” name =”input”>

Display The developer wrote the javascript code below:

Const button = document.querySelector(‘button’);

button.addEvenListener(‘click’, () => (

Const input = document.querySelector(‘input’);

console.log(input.getAttribute(‘value’));

When the user clicks the button, the output is always “Hello”.

What needs to be done to make this code work as expected?


A.

Replace line 04 with console.log(input .value);


B.

Replace line 03 with const input = document.getElementByName(‘input’);


C.

Replace line 02 with button.addCallback(“click”, function() {


D.

Replace line 02 with button.addEventListener(“onclick”, function() {


Get Premium JavaScript-Developer-I Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.