I have an input field <input> with id my-field to which some plugin adds the attribute disabled="disabled" after the first escape.
This is a problem so i'm trying to keep that disabled attribute away from it with the code below:
var input = document.getElementById("my-field");
document.addEventListener("change", input, function(){
setTimeout(function() {
input.disabled = false;
}, 50)
});
but it's not working, what am I doing wrong?
EDIT: as suggested below i corrected the boolean to have no "" but it's not working.
false.addEventListener()API does not work that way. You add listeners directly to elements. What you have above is how you'd do it with jQuery, sort-of, and you included jQuery as a tag in the question. If you're not really using jQuery, you should remove the tag.