Created
September 10, 2013 08:08
-
-
Save scottrobertson/6506373 to your computer and use it in GitHub Desktop.
Random idea for text case management on text fields.
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
$('[data-case]').on('change', function () { | |
var field = $(this); | |
var case = field.data('case'); | |
if (case === 'upper') { | |
var newVal = field.val().toUpper(); | |
} else { | |
var newVal = field.val().toLower(); | |
} | |
field.val(newVal); | |
}) |
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
<input type="text" data-case="upper" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment