How to create a bookmarklet to change maxlength of an input box

33 Views Asked by At

I've got this enter image description here and want to change the maxlength value to, lets say, 2000 with a simple click of a bookmarklet, yet I'm clueless how JS works, so any help is appreciated.

Thanks in advance!

I've scoured google for something similar, but I don't seem to be able to find anything that I can apply to my case. :(

1

There are 1 best solutions below

0
Braian Pita On BEST ANSWER

You need to get the corresponding element using something like querySelector, and then use setAttribute:

var el = document.querySelector(".textareaHolder textarea");
el.setAttribute('maxLength',2000);