Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<meta charset=utf-8 />
<title>Example</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
  body {
    font-family: sans-serif;
  }
</style>
</head>
<body>
  <input type="text" id="dp">
</body>
</html>
 
jQuery(function($) {
  
  function RangeSelector(name) {
    this.name = name;
  }
  RangeSelector.prototype.myFunction = function(dateText, inst, element) {
    display(this.name + " says: Selected, making the element green");
    $(element).css("color", "green");
  };
  
  var r = new RangeSelector("Fred");
  
  $("#dp").datepicker({
    onSelect: function(dateText, inst) {
      return r.myFunction(dateText, inst, this);
    }
  });
  
  function display(msg) {
    $("<p>").html(msg).appendTo(document.body);
  }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers