milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. JavaScript
  4. jQuery

Global function

Details
Written by: Stanko Milosev
Category: jQuery
Published: 20 November 2012
Last Updated: 30 November -0001
Hits: 3358

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>

How To Prevent jQuery UI Slider Overlap In jQueryUI

Details
Written by: Stanko Milosev
Category: jQuery
Published: 16 August 2012
Last Updated: 16 August 2012
Hits: 4822

Easy :)

 $( "#range" ).slider({
            range: true,
            min: 0,
            max: 100,
            values: [ 50, 60 ],
            step: 10,
            slide: function( event, ui ) {
                if (ui.values[0] == ui.values[1]) { /*checks for the values and compares*/
                    return false;
                }
            }

From here

Retrieving the dateFormat from jQuery UI datepicker and formating date

Details
Written by: Stanko Milosev
Category: jQuery
Published: 15 August 2012
Last Updated: 15 August 2012
Hits: 3385
  alert($.datepicker._defaults.dateFormat);
  var strMyDate = $.datepicker.formatDate($.datepicker._defaults.dateFormat, new Date(2007, 1 - 1, 26));
  alert(strMyDate);

Taken from here.

Page 5 of 5

  • 1
  • 2
  • 3
  • 4
  • 5