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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -