I want to title case form inputs using the humanize library and Jquery. So far I have this:
$("#FirstName,#LastName").blur(function () {
Humanize.titleCase( $(this) )
});
but it gives me an error:
humanize.min.js:2 Uncaught TypeError: n.split is not a function
at o (humanize.min.js:2)
at Object.titleCase (humanize.min.js:2)
at HTMLInputElement.<anonymous> (<anonymous>:3:14)
at HTMLInputElement.dispatch (jquery-2.2.4.min.js:3)
at HTMLInputElement.r.handle (jquery-2.2.4.min.js:3)
Humanize.titleCase( $(this) )
should be
Humanize.titleCase( $(this).val() );
Update after @vlaz comment
the full code will be something like
$("#FirstName,#LastName").blur(function () {
$(this).val( Humanize.titleCase( $(this).val() ) );
});