10 hours
- Medium
Free online content available in this course.
course.header.alt.is_video
course.header.alt.is_certifying
Got it!Last updated on 4/2/20
Get data from users and from servers
Evaluated skills
- handle user input
Question 1
Which of the following gives access to the data entered by the user in the input with id
first-name
?let input = document.getElementById('first-name').textContent;
let input = document.getElementById('first-name').input;
let input = document.getElementById('first-name').value;
let input = document.getElementById('first-name').innerHTML;
Question 2
Which of the following event listeners will be triggered when the user clicks or tabs into the input with id
email
?- document.getElementById('email').addEventListener('click', () => {console.log('Input activated!');});
- document.getElementById('email').addEventListener('focus', () => {console.log('Input activated!');});
- document.getElementById('email').addEventListener('blur', () => {console.log('Input activated!');});
- document.getElementById('email').addEventListener('enter', () => {console.log('Input activated!');});
Question 3
Which of the following listeners will log the state of the checkbox with id
available
to the console whenever the user checks or unchecks it?- document.getElementById('available').addEventListener('change', ($event) => {console.log('Available: ' + $event.target.checked);})
- document.getElementById('available').addEventListener('change', ($event) => {console.log('Available: ' + $event.checked);})
- document.getElementById('available').addEventListener('change', ($event) => {console.log('Available: ' + $event.value);})
- document.getElementById('available').addEventListener('change', ($event) => {console.log('Available: ' + $event.target.value);})
Ever considered an OpenClassrooms diploma?
- Up to 100% of your training program funded
- Flexible start date
- Career-focused projects
- Individual mentoring
Find the training program and funding option that suits you best