0
    var elelist = document.getElementsByTagName("input");
for(var i = 0; i < elelist.length; i++){
    elelist[i].addEventListener("focus", function(){
        this.blur();
    });
}

http://www.bootply.com/M30Ge1FgNo

The JS above looks for a focused input and then adds .blur to it. I'm trying to stop input from focusing first. But the above stops me using it altogether. Probably need to add a timeout to the .blur so it can be used after the list items have appeared. How do I add a timeout to remove .blur or refocus/remove .blur from the input.

Tom Rudge
  • 3,188
  • 8
  • 52
  • 94
  • 1
    This might help: http://stackoverflow.com/questions/5660131/how-to-removeeventlistener-that-is-addeventlistener-with-anonymous-function – Rajesh Nov 09 '16 at 17:50
  • How about `for(var i = 0; i < elelist.length; i++){ elelist[i].setAttribute("readonly","readonly"); }` – mplungjan Nov 09 '16 at 17:52

0 Answers0