javascriptdombookmarkletbookmarks

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


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. :(


Solution

  • 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);