No problem,




are the same - both will run whatever you have in them when the DOM is ready - the second is just a kind of shorthand for the (much easier to read) first. Docs:



When you have multiple instances of these constructs in your scripts, the code within them will run in the order in which they are defined, so in your example, what was happening was the first $("#elements").sortable(); (defined within the $(function(){}); block) was creating the sortable list - the second call (within $(document).ready) was ignored.

Hope this helps,


on 23/02/2010 10:32 rafald said::
Hi Peter,
Indeed! It works ;-) THANKS!
It was enough to remove line with >> $("#elements").sortable(); <<

So, what is the right place to put:

in my example:
the first place was outside "$(document).ready(function()"
the second place (where I added event) was inside "$

What are the rules  here and what will be difference if I put inside
or outside ?
Could you please explain this to me ?


Reply via email to