According to the API, you can have as many $(function(){}); in a page
as you'd like. http://docs.jquery.com/Events/ready

It just depends on the needs of your project. If it's imperative that $
("#myrandomdiv").corner("7px") is applied after $(".myboxclass").corner
("7px"); completes, then leave them separate as in your second
example.


On Aug 10, 6:15 am, Jesper F <jesperfjoel...@gmail.com> wrote:
> I Include my javascript in an includefile. Which is better way to
> organize the jQuery code:
>
>     $(function(){
>         $(".myboxclass").corner("7px");
>         $("#myrandomdiv").corner("7px");
>     });
>
> or
>
>     $(function(){
>         $(".myboxclass").corner("7px");
>     });
>
>     $(function(){
>         $("#myrandomdiv").corner("7px");
>     });
>
> that is in two sections. Is the last just wasting space? they seem to
> be working the same.
> Thanks.

Reply via email to