Remove all blank spaces from string using JQuery – onlinecode

How to remove all blank spaces from string using JQuery – onlinecode

In this post we will give you information about How to remove all blank spaces from string using JQuery – onlinecode. Hear we will give you detail about How to remove all blank spaces from string using JQuery – onlinecodeAnd how to use it also give you demo for it if it is necessary.

In this post, We give you an example, sometimes require the remove all spaces from a string, jquery through easily remove spaces from a string.

sometimes use the trim function to remove space from a string but here all spaces remove from a string, so here used replace function.

See below example

 

 

 

<html>
<head>
    <title>How to remove all blank spaces from string using JQuery? - onlinecode</title>  
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>

<div>
  <h1>How to remove all blank spaces from string using JQuery? - onlinecode</h1>
  <input  name="txtDescription" value="How to remove all blank spaces from string using JQuery? - onlinecode">
  <button>Remove</button>
</div>
<script type="text/javascript">
  $("button").click(function(){
  	  var txtDescription = $(".txtDescription").val();
      var data = txtDescription.replace(/s/g, '');
      alert(data);
	  
      //output
      //HowtoremoveallblankspacesfromstringusingJQuery?-onlinecode
  });
</script>
</body>
</html>

Please follow and like us:

Hope this code and post will helped you for implement How to remove all blank spaces from string using JQuery – onlinecode. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  9  =  18

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US