javascript - focus filtering select on page load -



why following code don't focus filteringselect?

    <!doctype html>     <html>     <head>     <script type="text/javascript" src="http://yandex.st/dojo/1.6.0/dojo/dojo.xd.js" djconfig="parseonload: true"></script>     <style type="text/css">             @import "http://yandex.st/dojo/1.6.0/dijit/themes/claro/claro.css";     </style>     <script type="text/javascript">     <!--     dojo.require("dijit.form.filteringselect");      dojo.addonload(function(){         dijit.byid('dept').focus();     });      -->     </script>     </head>     <body class="claro">     <select name="dept" id="dept" dojotype="dijit.form.filteringselect" >         <option value=""></option>         <option value="test">test</option>         <option value="test1">test1</option>     </select>     </body>     </html> 

i tried ie7 , firefox 3/4 - works.
fails in ie8 :-(
may dojo bug - or doing wrong?
when dojo.addonload() fire? after dom ready, or after widgets have been initalized?
regards
gerhard

it's intresting bug.. have made small research , found solution. maybe looks "dirty hack", still can you.

you can add timeout:

dojo.addonload(function () {         settimeout(function () { dijit.byid('dept').focus() }, 400); }); 

not noticeable user gives ie moment breathe.

it's work in ie8 me


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -