input - Change form value= attribute with Javascript -
i need simple javascript change value= attribute 2 when page loaded.
<input type="number" step="1" min="1" name="quantity" value="1" title="qty" class="input-text qty text">
addeventlistener('load', function() { document.getelementsbyclassname('qty')[0].value = 2; }); - you first add event listener
loadevent, runs after page's loaded - within event listener's callback function, select element. in script, select class
qty, since class seemed specific of three. should addidattribute input accurately select though. - you first result, @ index
[0], , set value 2.
Comments
Post a Comment