If para1 is the dom object for a paragraph, what is the correct syntax to change the text within the paragraph?
Answers
para1.value="New Text "
Answer:
Option B is correct answer
Explanation:
If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?
A. "New Text"?
B. para1.value="New Text";
C. para1.firstChild.nodeValue= "New Text";
D. para1.nodeValue="New Text";
Explanation for the correct answer:
Option C is correct since the name of the paragraph element is para1 in the DOM. The attribute value of the paragraph is Value which will assign some values like text, number, image, video, audio
Explanation for the incorrect answer
Another option is entirely different from the option B
Option A is simply assigned with a value string
Option C is simply assigned with node value where it is added for children.
Option D is assigned with node value without the children.