Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #535 from jarrettv/master

Looks like most everything made it into 1.2.6
  • Loading branch information...
commit fc1115e63a5263754a6a562aff21778c4269b5ac 2 parents 17ef6a2 + 766262d
Brad Robertson bradrobertson authored

Showing 1 changed file with 13 additions and 5 deletions. Show diff stats Hide diff stats

  1. +13 5 src/dateinput/dateinput.js
18 src/dateinput/dateinput.js
@@ -282,6 +282,10 @@
282 282 currMonth = date.getMonth();
283 283 currDay = date.getDate();
284 284
  285 + // focus the input after selection (doesn't work in IE)
  286 + if (e.type == "click" && !$.browser.msie) {
  287 + input.focus();
  288 + }
285 289
286 290 // beforChange
287 291 e = e || $.Event("api");
@@ -317,13 +321,13 @@
317 321 if (e.ctrlKey) { return true; }
318 322 var key = e.keyCode;
319 323
320   - // backspace clears the value
321   - if (key == 8) {
  324 + // backspace or delete clears the value
  325 + if (key == 8 || key == 46) {
322 326 input.val("");
323 327 return self.hide(e);
324 328 }
325 329
326   - // esc or tab key
  330 + // esc or tab key exits
327 331 if (key == 27 || key == 9) { return self.hide(e); }
328 332
329 333 if ($(KEYS).index(key) >= 0) {
@@ -664,11 +668,11 @@
664 668 e.type = "onHide";
665 669 fire.trigger(e);
666 670
667   - $(document).unbind("click.d").unbind("keydown.d");
668   -
669 671 // cancelled ?
670 672 if (e.isDefaultPrevented()) { return; }
671 673
  674 + $(document).unbind("click.d").unbind("keydown.d");
  675 +
672 676 // do the hide
673 677 root.hide();
674 678 opened = false;
@@ -729,6 +733,10 @@
729 733 if (!opened && $(KEYS).index(key) >= 0) {
730 734 self.show(e);
731 735 return e.preventDefault();
  736 +
  737 + // clear value on backspace or delete
  738 + } else if (key == 8 || key == 46) {
  739 + input.val("");
732 740 }
733 741
734 742 // allow tab

0 comments on commit fc1115e

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