64 ms·
> Here worth mentioning that elements with an id can be accessed as window[id] or window.id. The thing that wasn’t standardized for a long time and has been a h
by smusamashah 6y ago
> Here worth mentioning that elements with an id can be accessed as window[id] or window.id. The thing that wasn’t standardized for a long time and has been a hack from IE, now has become a standard.
Didn't know this.
- abdusco 6y agoYou can access forms using `document.forms.$name`. Form needs to have `name` attribute set, though. You can also access input elements using `form.elements.$inputName`. <form name="contact"> <input name="message"/> </form> this form can be accessed directly using const form = document.forms.contact const message = form.elements.message