+ 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!"); });

4th Jan 2020, 10:13 AM
Yogeshwaran
10 odpowiedzi
+ 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/
4th Jan 2020, 2:13 PM
Edwin Pratt
Edwin Pratt - avatar
+ 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.
4th Jan 2020, 10:45 AM
Ipang
+ 2
Ipang is correct. The function gets attached to window.onliad and gets called when the page is loaded.
4th Jan 2020, 10:54 AM
Edwin Pratt
Edwin Pratt - avatar
+ 2
Thanks bro.now I clarify my doubt.
4th Jan 2020, 2:15 PM
Yogeshwaran
+ 1
Is it necessary to add window.onload to call a function.
4th Jan 2020, 2:07 PM
Yogeshwaran
+ 1
I am sure that jQuery does it for you 😇
4th Jan 2020, 2:08 PM
Edwin Pratt
Edwin Pratt - avatar
+ 1
So we don't want to add window.onload in jQuery to call function.i'm right.isnt Edwin bro?
4th Jan 2020, 2:10 PM
Yogeshwaran
+ 1
It's my pleasure 😇🤗
4th Jan 2020, 2:15 PM
Edwin Pratt
Edwin Pratt - avatar
+ 1
👍 😊😊😊😊🙋
4th Jan 2020, 2:16 PM
Yogeshwaran
+ 1
Thanks my friend
4th Jan 2020, 2:18 PM
Yogeshwaran