98-382 Exam QuestionsBrowse all questions from this exam

98-382 Exam - Question 3


You are designing a web page with a script that must dynamically change the content of a paragraph element to display the value returned by the function

.

randomQuote()

You have created the following code. Line numbers are included for reference only.

Exam 98-382 Question 3

Which code segment should you use at line 08?

Show Answer
Correct Answer: C

To dynamically change the content of a paragraph element, the innerHTML property is used. This property sets or returns the HTML content inside an element. In this case, we want to update the content of the paragraph with the id 'tester' to display a new quote from the randomQuote() function. Therefore, the correct code segment to use is document.getElementById('tester').innerHTML = randomQuote();.

Discussion

1 comment
Sign in to comment
computercat
Sep 23, 2021

document.getElementById("tester").innerHTML = randomQuote(); Because it's a paragraph, they update using .innerHTML and not .value, .script or .title