How To Remove Spaces Using JQuery

WebSolutionStuff | Aug-10-2020 | Categories : Laravel PHP jQuery

In this article, we will explain to you how to remove extra space using jquery. many times we have requirements to remove white space from the textbox or many times users added unnecessary space in fields which occupied more space in the database.

I am giving you a very simple example to remove white space from the textbox. in this example, I have added one text box to add a string and one submit button and you will get output in an alert box.

So, let's see remove blank space from string jquery or javascript remove all whitespaces from a string.

<html lang="en">
    <title>How to remove spaces using JQuery -</title>  
    <script src=""></script>

  <h1>How to remove spaces using JQuery -</h1>
  <textarea class="content-text">
  	This is demo how to remove space using jquery.
  <button>Remove Space</button>

<script type="text/javascript">
  	  removeText = $(".content-text").val();
      var rm_space = removeText.replace(/ /g,'');



You might also like:

Recommended Post

Featured Post

Follow us
facebooklogo github instagram twitter