- 10 heures
- Moyenne
Ce cours est visible gratuitement en ligne.
course.header.alt.is_video
course.header.alt.is_certifying
J'ai tout compris !Mis à jour le 02/04/2020
Get data from users and from servers
Compétences évaluées
- 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); })
Et si vous obteniez un diplôme OpenClassrooms ?
- Formations jusqu’à 100 % financées
- Date de début flexible
- Projets professionnalisants
- Mentorat individuel
Trouvez la formation et le financement faits pour vous