javascript get child by name 1

javascript get child by name

let myForm = document.getElementById('form');

let child = myForm.querySelector('input[name="username"]');

console.log(child);

Here is what the above code is Doing:
1. We select the form element with the id of form.
2. We select the input element with the name of username.
3. We log the input element to the console.

Similar Posts