jQuery Tutorial
function showMessage(){ alert("Welcome!"); }
<html> <head> <title>The jQuery Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type = "text/javascript"> function showMessage(){ document.write("welcome to 'jQuery!"); } $(document).ready(function(){ showMessage(); }); </script> </head> <body></body> </html>Output:
var message = function (){ return "Welcome!"; }
<html> <head> <title>The jQuery Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type = "text/javascript"> var message = function (){ document.write("welcome to 'jQuery!"); } $(document).ready(message); </script> </head> <body></body> </html>Output:
$(document).ready(function(){ document.write("welcome to 'jQuery'!"); });
function showMessage(msg){ alert(msg); }
<html> <head> <title>The jQuery Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type = "text/javascript"> function showMessage(msg){ document.write("type: " + typeof msg +", args count: " + arguments.length + ", msg: " + msg + "Output:
"); } function showArgs() { document.write("type: " + typeof arguments+", args count: " + arguments.length + ", arg[1]: " + arguments[1] + ", callee: "+ arguments.callee+ "
"); } $(document).ready(function(){ showMessage("welcome to 'jQuery'!"); showMessage(1); showMessage(1, 20.5, "welcome to 'jQuery'!"); showArgs(1, 20.5); }); </script> </head> <body></body> </html>
function ( ) { var myVar = "local"; // local variable document.write(myVar); }
var globalVar = "global"; // global variable function ( ) { var localVar = "local"; // local variable alert(localVar); }
jQuery Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page