- Details
- Written by: Stanko Milosev
- Category: jQuery
- Hits: 4295
For example, if you have JS file in which you want to call function from another js file, something like onClose event of datePicker:
test.js:
$(function() {
$('#datepicker').datepicker({dateFormat: 'yy-mm-dd',
onClose: function(dateText) {
myCall();
}
});
});
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script src="/test.js"></script>
<script>
var myTest = function myFunc() {
alert("test");
};
myCall = myTest;
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>