ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 114 - Certified JavaScript Developer I discussion

Report
Export

Refer to the code below:

<html lang="en">

<table onclick="console.log(Table log');">

<tr id="row1">

<td>Click me!</td>

</tr>

<table>

<script> function printMessage(event) { console.log('Row log');

}

Let elem = document.getElementById('row1'); elem.addEventListener('click', printMessage, false);

</script>

</html>

Which code change should be made for the console to log only Row log when 'Click me! ' is clicked?

A.
Add.event.stopPropagation(); to window.onLoad event handler.
Answers
A.
Add.event.stopPropagation(); to window.onLoad event handler.
B.
Add event.stopPropagation(); to printMessage function.
Answers
B.
Add event.stopPropagation(); to printMessage function.
C.
Add event.removeEventListener(); to window.onLoad event handler.
Answers
C.
Add event.removeEventListener(); to window.onLoad event handler.
D.
Add event.removeEventListener(); toprintMessage function.
Answers
D.
Add event.removeEventListener(); toprintMessage function.
Suggested answer: B
asked 23/09/2024
Samer Chaar
27 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first