Created
September 23, 2016 21:11
-
-
Save shaosh/80a72508bb00b89e546b42a0bdda0de5 to your computer and use it in GitHub Desktop.
Dynamically turn autofill on and off
This file contains hidden or 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
$('#addrBox').on('mouseup keyup', function(){ | |
var $this = $(this); | |
var val = $this.val(); | |
val = val.length; | |
if(val === 0){ | |
$this.attr('autocomplete', 'on'); | |
} | |
else{ | |
$this.attr('autocomplete', 'off'); | |
} | |
}).on('mousedown keydown', function(){var $this = $(this); | |
var val = $this.val(); | |
var length = val.length; | |
if(!length){ | |
$this.attr('autocomplete', 'new-password'); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment