How to use Callback Before Function in JQuery
In this article I am going to explain about Callback before function in jquery.
Query Callback Before function
jquery callback function use for display an message before any action. When event occurs then firstly a message will be display after that action will be complete.
Syntax
$("selector").hide(1000);
alert("Your message");
|
Example
In this example when you click on button firstly message will display then after code will be execute.
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("h3").hide(1000);
alert("This heading is now hidden");
});
});
</script>
</head>
<body>
<button>
click me</button>
<h3>
Click Button For Hide
</h3>
</body>
</html>
|
Output
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here