Microsoft
98-375 · Question #55
Your code includes the following fragment: <input type="text" name="text1" id="myText" /> You need to add code that will retrieve the contents of the INPUT element. Which JavaScript code fragment…
The correct answer is B. vartxtContents = document.getEIementyById('myText').value. See the full explanation below for the reasoning.
Question
Your code includes the following fragment:
<input type="text" name="text1" id="myText" /> You need to add code that will retrieve the contents of the INPUT element. Which JavaScript code fragment will accomplish this?
Options
- AvartxtContents =document.getElementById('text1').value;
- BvartxtContents = document.getEIementyById('myText').value;
- CvartxtContents =document.getElementById('text1');
- DvartxtContents = document.getElementById('myText');
How the community answered
(56 responses)- A2% (1)
- B82% (46)
- C5% (3)
- D11% (6)
Community Discussion
No community discussion yet for this question.