About 101,000 results
Open links in new tab
  1. Trim string in JavaScript - Stack Overflow

    Jan 31, 2009 · Explanation: The function trim () accept a string object and remove any starting and trailing whitespaces (spaces,tabs and newlines) and return the trimmed string.

  2. trim - String strip () for JavaScript? - Stack Overflow

    Jun 11, 2022 · How do I strip leading and trailing spaces from a string? For example, " dog " should become "dog".

  3. How to trim specific characters from the end of the JavaScript string ...

    In JavaScript, how do I trim from the right (string end)? I have the following example:

  4. How to trim() white spaces from a string? - Stack Overflow

    JavaScript doesn't seem to have a native trim() method. How can I trim white spaces at the start and end of a string with JavaScript?

  5. javascript - How can I remove leading and trailing rendered as white ...

    Mar 14, 2024 · I've the following string containing HTML. What would be sample code in JavaScript to remove leading and trailing white spaces that would appear in the rendering of this string? In other …

  6. Remove whitespaces inside a string in javascript

    May 29, 2012 · 209 I've read this question about javascript trim, with a regex answer. Then I expect trim to remove the inner space between Hello and World.

  7. javascript - Remove ALL white spaces from text - Stack Overflow

    This is a snippet from my code. I want to add a class to an ID after getting another ID's text property. The problem with this, is the ID holding the text I need, contains gaps between the letters. I would …

  8. Trim spaces from start and end of string - Stack Overflow

    223 Note: As of 2015, all major browsers (including IE>=9) support String.prototype.trim (). This means that for most use cases simply doing str.trim() is the best way of achieving what the question asks. …

  9. regex - Left Trim in Javascript - Stack Overflow

    There are a lot of scripts out there to trim a string in JavaScript, but none that allow you to just left trim a string. This is what I use to trim: String.prototype.trim = function() { return ...

  10. Remove all white space from string JavaScript - Stack Overflow

    var str = " abc de fog "; str.trim(); Gives abc de fog AND NOT abcdefog, which I want. How can I get all the white space removed using JavaScript?