Removing Whitespace from Strings or Form Values with jQuery.trim - J Query

You have an input form and need to remove the whitespace that a user may have entered at either the beginning or end of a string.


Up on the user blurring a field, the value as entered by the user—$(this). val()—is retrieved and passed through the $.trim() method that strips all white space characters (space, tab, and new line characters) from the beginning and end of the string. The trimmed string is then set as the value of the input field again.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

J Query Topics