Im kinda new to js, trying to change value of "email" input field
<div class="input-group type-email">
<div class="input-label has-placeholder-label">
<label for="">Your Email Address</label>
</div>
<div class="inputs">
<input name="email" value="" placeholder="" type="email">
</div>
</div>
I've found a bunch of articles saying how to find an element by id. How can I do it without id, by type maybe? Thank you.
forattr is bad. You can fix it by giving the input an ID (id="email", say) and updating the for attr to refer to the ID (for="email"). w3.org/TR/WCAG20-TECHS/H44document.getElementsByName('email')[0], or if the control is in a form there are more convenient methods, both will work in every browser everywhere.