+ 1
While using function in jquery, that code is given below.which will call this function.
<!DOCTYPE html> <html> <head> <title>Page Title</title> <script src="https://code.jquery.com/jquery-3.1.1.js"></script> </head> <body> <div id="start">Start</div> </body> </html> $(function() { $("#start").html("Go!"); });
10 Réponses
+ 2
Yogeshwaran that's right. You don't need to write window.onload 😇
According to the jQuery lesson, the $(function () {}); calls window.onload for you 😉
Source:
https://www.sololearn.com/learn/jQuery/2785/
+ 2
You mean the jQuery function under the </html>?
I guess it runs after the page is loaded completely, considering where it is placed in.
(Edit)
You forgot to put the jQuery function inside <script> tag, that function will be printed as plain text because of this minor issue.
+ 2
Ipang is correct. The function gets attached to window.onliad and gets called when the page is loaded.
+ 2
Thanks bro.now I clarify my doubt.
+ 1
Is it necessary to add window.onload to call a function.
+ 1
I am sure that jQuery does it for you 😇
+ 1
So we don't want to add window.onload in jQuery to call function.i'm right.isnt Edwin bro?
+ 1
It's my pleasure 😇🤗
+ 1
👍 😊😊😊😊🙋
+ 1
Thanks my friend