70-480 Exam QuestionsBrowse all questions from this exam

70-480 Exam - Question 93


You troubleshoot a webpage that contains the following HTML markup: (Line numbers are included for reference only.)

Exam 70-480 Question 93

The webpage also contains the following JavaScript function named someEvent() that is declared in the HEAD section of the HTML:

Function someEvent() {

Alert('someEvent fired!');

}

The JavaScript function named someEvent() must run only when the user clicks the DIV element, not the INPUT elements.

You need to modify the webpage to invoke the JavaScript function named someEvent().

What should you do? (Each correct answer presents a complete solution. Choose two.)

Exam 70-480 Question 93
Show Answer
Correct Answer: AC

To ensure the JavaScript function someEvent() is run only when the DIV element is clicked and not when the INPUT elements are clicked, modify all INPUT elements to stop the event from propagating using stopPropagation(event) allows the event to be controlled and prevented from bubbling up to the DIV. Additionally, updating the DIV element and modifying the someEvent() function to check if the event target is the DIV itself allows for precise control.

Discussion

4 comments
Sign in to comment
MoSalah10
Jan 15, 2020

A and C https://jsfiddle.net/skz1cv60/1/

KyryIx
Mar 3, 2020

I agree with your answer. Only replace "event.canelBubble = true;" by "event.cancelBubble = true;" in your code, on line 9.

Alphasoldier
Jun 8, 2020

If you remove everything related to 'stopPropagation' everything will still work as per the requirement, so not A? https://jsfiddle.net/18t9kqxe/1/

VEERAKUMAR
Jan 27, 2020

A and C is correct answer

eMax
Oct 17, 2019

onclick="stopPropagation(event)" should be added to the surrounding span element, not to the inputs.

nootje
Oct 5, 2021

tested it in vscode and chrome and A & C are the correct answers. B doesn't do anything at all