Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to stop datepicker from beforeShow
Small patch to allow stopping the datepicker from a beforeShow event handler. Just checking to see if the return from the beforeShow handler is === false. If it is === false then we return the same way as if the datepicker is disabled.
- Loading branch information
Karl Kirch
committed
Jul 6, 2011
1 parent
96de2aa
commit c18edae
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>jQuery UI Datepicker - Default functionality</title> | ||
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> | ||
<script src="../../jquery-1.5.1.js"></script> | ||
<script src="../../ui/jquery.ui.core.js"></script> | ||
<script src="../../ui/jquery.ui.widget.js"></script> | ||
<script src="../../ui/jquery.ui.datepicker.js"></script> | ||
<link rel="stylesheet" href="../demos.css"> | ||
<script> | ||
$(function() { | ||
var showme = false; | ||
$( "#datepicker_canceled" ).datepicker({ | ||
beforeShow: function(input, inst) { | ||
if(!showme) { | ||
return false; | ||
} | ||
} | ||
}); | ||
$( "#datepicker" ).datepicker({ | ||
beforeShow: function(input, inst) { | ||
} | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
|
||
<div class="demo"> | ||
|
||
<p>Canceled date field: <input type="text" id="datepicker_canceled"></p> | ||
<p>Not canceled date field: <input type="text" id="datepicker"></p> | ||
|
||
</div><!-- End demo --> | ||
|
||
|
||
|
||
<div class="demo-description"> | ||
<p>By returning false from a beforeShow event, you can stop the datepicker from showing.</p> | ||
</div><!-- End demo-description --> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters