Skip to content

Instantly share code, notes, and snippets.

@scottrobertson
Created September 10, 2013 08:08
Show Gist options
  • Save scottrobertson/6506373 to your computer and use it in GitHub Desktop.
Save scottrobertson/6506373 to your computer and use it in GitHub Desktop.
Random idea for text case management on text fields.
$('[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);
})
<input type="text" data-case="upper" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment