jquery - Disable Text Field Autofocus in Javascript -
is there way in javascript forcibly disable text field autofocus on page load?
i know of focus() method, not how disable it. actual problem autofocusing in modal window forces window appear scrollbar halfway down , scrolled first input field, whereas disable entirely.
thanks!
you can use .blur()
,
var elelist = document.getelementsbytagname("input"); for(var = 0; < elelist.length; i++){ elelist[i].blur(); }
if want disable focus on textfields,
var elelist = document.getelementsbytagname("input"); for(var = 0; < elelist.length; i++){ elelist[i].addeventlistener("focus", function(){ this.blur(); }); }
Comments
Post a Comment