Created
June 7, 2023 16:23
-
-
Save yashasvi9199/abf9e0249d1f8f4e8195bcfae7a31dcb to your computer and use it in GitHub Desktop.
Trim space from beginning and end in input text field
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
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> | |
</head> | |
<body> | |
<h2>Please Enter Input</h2> | |
<input type="text" placeholder="Enter input" onblur="trimmer(this.value)"> | |
<script> | |
function trimmer(val) { | |
var replace = $.trim(val); | |
$("input").val(replace); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment