Last active
July 26, 2023 05:43
-
-
Save Mahendran-Balaji/dbc2dd8f1aa269bdbb600e4ebcf25b64 to your computer and use it in GitHub Desktop.
Allowed lower case (a-z), Upper Case (A-Z) and one space between the string using jQuery
This file contains 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
/* javascript-string-replace-more-space-into-single-space */ | |
$('#blogtitle').bind('keyup blur', function() { | |
var $th = $(this); | |
$th.val($th.val().replace(/(\s{2,})|[^a-zA-Z']/g, ' ')); | |
$th.val($th.val().replace(/^\s*/, '')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment