$.fn.myFunction=function(){}
The syntax for defining a function in jQuery is little bit different from the JavaScript. Let's take a look at the following example to understand how to define a function in jQuery.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Define a Function in jQuery</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function(){
$.fn.myFunction = function(){
alert('You have successfully defined the function!');
}
$(".call-btn").click(function(){
$.fn.myFunction();
});
});
</script>
</head>
<body>
<button type="button" class="call-btn">Click Me</button>
</body>
</html>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to find IP address on Ubuntu
Want to know what is your Ubuntu desktop...How to Take Screenshots on Ubuntu 20.04
Ubuntu 18.04 LTS and later versions has...Paypal Card Payment REST API integration in Laravel 6
In this article we will share with you h...How to get Last Record From leftJoin Table in Laravel?
get the latest record from leftJoin tabl...How to find mouse position relative to the document using jQuery
Use the jQuery event.pageX and...