[jQuery] Re: $(button).Bind(click, function) Vs button onClick=function/

2009-04-16 Thread Andy Matthews

Try disabling the button, then reenabling it with jQuery? 

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of reach4thelasers
Sent: Thursday, April 16, 2009 8:39 AM
To: jQuery (English)
Subject: [jQuery] $(button).Bind(click, function) Vs button
onClick=function/


I know that the recommended usage in all the books/blogs/web sites is
the bind() method in the$(document).ready(function() {}

 However I am finding that very often my users are taking action by clicking
etc before the page has completely loading. This usually results in a full
form postback instead of AJAX, or worse nothing happens at all.

I understand that the bind method within the .ready function works best if
the handler requires an element further down the page that may not have been
loaded yet.  But if I do not rely on anything further down the page, is
there any good reason not to use the onClick=
attribute, to wire-up my event handlers immediately rather than waiting for
the full page to be loaded?




[jQuery] Re: $(button).Bind(click, function) Vs button onClick=function/

2009-04-16 Thread Donny Kurnia

Andy Matthews wrote:
 Try disabling the button, then reenabling it with jQuery? 
 
 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
 Behalf Of reach4thelasers
 Sent: Thursday, April 16, 2009 8:39 AM
 To: jQuery (English)
 Subject: [jQuery] $(button).Bind(click, function) Vs button
 onClick=function/
 
 
 I know that the recommended usage in all the books/blogs/web sites is
 the bind() method in the  $(document).ready(function() {}
 
  However I am finding that very often my users are taking action by clicking
 etc before the page has completely loading. This usually results in a full
 form postback instead of AJAX, or worse nothing happens at all.
 
 I understand that the bind method within the .ready function works best if
 the handler requires an element further down the page that may not have been
 loaded yet.  But if I do not rely on anything further down the page, is
 there any good reason not to use the onClick=
 attribute, to wire-up my event handlers immediately rather than waiting for
 the full page to be loaded?
 

Or, make it hidden with css, then show it using jquery. Consider to
optimize your page, so it load faster. Use lazyload to load big images,
trim out it's size, use compression, etc.

Other approach, use google technique for gmail, all the element is
loaded thought XMLHttpRequest, so there will be no premature click.

--
Donny Kurnia
http://hantulab.blogspot.com
http://www.plurk.com/user/donnykurnia