Tuesday, December 6, 2016

JavaScript - document.ready() - Q&A

Question:

What is the difference between these two lines of code?


$(document).ready(function() {}); // first line

$(function() {}); // second line


Answer


The two lines do exactly the same. The second line is just a shorten way for the first line.
 Both set the method for document ready.

No comments:

Post a Comment