Without using setTimeout it seems to be working for me on a very basic
page:
http://jsbin.com/ezavi

It should alert 'browser' when the page loads. Works for me on both
FF3.0.8 and IE6
Maybe something else in your code must be causing the issue.

On Apr 8, 3:15 am, adudczak <adudc...@gmail.com> wrote:
> Hi,
>
> I'm not an expert in this, I've checked list archive and I didn't find
> nothing similar. If You know why this is happening please let me know.
>
> HTML is something like that:
>
> <form name="test" method="get" action="something">
>   <input name="handler" id="browser" type="radio" value="browser"
> checked="checked" class="defaultHandler"/>
>   <input name="handler" id="browser2" type="radio" value="browser2"  /
>
>   <input type="submit" name="submit_" value="submit" />
> </form>
>
> script adds function to click event of both radios and invokes click()
> on first one.
>
> <script type="text/javascript"><!--
> $(document).ready(function(){
>            $('input[name="handler"]').click(function() {
>                 alert(this.id);
>            });
>           $('input[name="handler"]:first').click();});
>
> // --></script>
>
> In IE 6.0 click() was not invoked. I've changed line with invocation
> to get this:
>  $('.defaultHandler').click(); didn't helped. But after adding
> setTimeout
> (setTimeout('$(".defaultHandler").click()',400);) it works like a
> charm. Can someone explain me what
> is going on? Why do I have use such a tricks? DOM manipulation in IE
> can be that slow...
>
> regards, Adam

Reply via email to