Skip to content

Commit

Permalink
Merge pull request #4 from drazvan/master
Browse files Browse the repository at this point in the history
Fixed a small problem
  • Loading branch information
alicial committed Nov 28, 2011
2 parents ad27396 + 003baef commit 6c133ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion demo/jquery.tagify.js
Expand Up @@ -33,14 +33,19 @@
}
}
})
// we record the value of the textfield before the key is pressed
// so that we get rid of the backspace issue
.keydown(function(e){
self.keyDownValue = $(this).val();
})
// for some reason, in Safari, backspace is only recognized on keyup
.keyup( function(e) {
var $this = $(this),
pressed = e.which;

// if backspace is hit with no input, remove the last tag
if (pressed == 8) { // backspace
if ( $this.val() == "" ) {
if ( self.keyDownValue == '' ) {
self.remove();
return false;
}
Expand Down
7 changes: 6 additions & 1 deletion jquery.tagify.js
Expand Up @@ -33,14 +33,19 @@
}
}
})
// we record the value of the textfield before the key is pressed
// so that we get rid of the backspace issue
.keydown(function(e){
self.keyDownValue = $(this).val();
})
// for some reason, in Safari, backspace is only recognized on keyup
.keyup( function(e) {
var $this = $(this),
pressed = e.which;

// if backspace is hit with no input, remove the last tag
if (pressed == 8) { // backspace
if ( $this.val() == "" ) {
if ( self.keyDownValue == '' ) {
self.remove();
return false;
}
Expand Down

0 comments on commit 6c133ca

Please sign in to comment.