Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is jQuery(document) vs. $(document)

I don't get what jQuery(document) is here. I thought you always used $(document)

see here in his examples: http://sorgalla.com/projects/jcarousel/

like image 348
PositiveGuy Avatar asked Jun 29 '09 13:06

PositiveGuy


People also ask

What is jQuery $( document?

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.

What is difference between $( document .ready function () vs $( function ()?

So technically they are both the same. Not major difference between these two declaration. They used based on weather you use JavaScript then you should use $(document). ready declaration in other case you use jQuery library which is a part of JavaScript then you should use $(function) declaration.

When we should use $( this in jQuery?

The value of this inside a click event is a DOM element (the one that was clicked). Using $(this) converts it to a jQuery object. DOM elements do not have a hide() methods, but jQuery adds that and many other methods you can then call.

What does $( document .ready function () mean?

The ready() method is used to make a function available after the document is loaded. Whatever code you write inside the $(document ). ready() method will run once the page DOM is ready to execute JavaScript code.


1 Answers

It's like <? versus <?php: one is a shorthand version that may be vulnerable to conflicts.

like image 139
chaos Avatar answered Oct 09 '22 10:10

chaos