javascript - How would I use tampermonkey to automatically enable longer sets of numbers -


<input type="text" name="turns" size="3" maxlength="4" value="99"> 

the max length there 4. im wondering put tampermonkey make automatically change max length longer, 6.

if wanted exactly ask, say

var i,myinputs = document.getelementsbyname("turns");  (i=0;i<myinputs.length;i++) {   if ( (myinputs[i].tagname.tolowercase()=="input")     && (myinputs[i].type.tolowercase()=="text")   ) myinputs[i].setattribute("maxlength","6"); } 

this lot of code; that's because there might more 1 element same name, , might not <input> elements, or might have type other "text". if don't care potential errors, say

document.getelementsbyname("turns")[0].maxlength = 6; 

which work fine long html refer appears once on page.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -

jquery - Keeping Kendo Datepicker in min/max range -