Skip to content
Browse files

Merge pull request #535 from jarrettv/master

Looks like most everything made it into 1.2.6
  • Loading branch information...
2 parents 17ef6a2 + 766262d commit fc1115e63a5263754a6a562aff21778c4269b5ac @bradrobertson bradrobertson committed Oct 25, 2011
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/dateinput/dateinput.js
View
18 src/dateinput/dateinput.js
@@ -282,6 +282,10 @@
currMonth = date.getMonth();
currDay = date.getDate();
+ // focus the input after selection (doesn't work in IE)
+ if (e.type == "click" && !$.browser.msie) {
+ input.focus();
+ }
// beforChange
e = e || $.Event("api");
@@ -317,13 +321,13 @@
if (e.ctrlKey) { return true; }
var key = e.keyCode;
- // backspace clears the value
- if (key == 8) {
+ // backspace or delete clears the value
+ if (key == 8 || key == 46) {
input.val("");
return self.hide(e);
}
- // esc or tab key
+ // esc or tab key exits
if (key == 27 || key == 9) { return self.hide(e); }
if ($(KEYS).index(key) >= 0) {
@@ -664,11 +668,11 @@
e.type = "onHide";
fire.trigger(e);
- $(document).unbind("click.d").unbind("keydown.d");
-
// cancelled ?
if (e.isDefaultPrevented()) { return; }
+ $(document).unbind("click.d").unbind("keydown.d");
+
// do the hide
root.hide();
opened = false;
@@ -729,6 +733,10 @@
if (!opened && $(KEYS).index(key) >= 0) {
self.show(e);
return e.preventDefault();
+
+ // clear value on backspace or delete
+ } else if (key == 8 || key == 46) {
+ input.val("");
}
// allow tab

0 comments on commit fc1115e

Please sign in to comment.
Something went wrong with that request. Please try again.