How to remove all whitespace from string in JQuery?

How to remove all whitespace from string in JQuery?

In this post we will give you information about How to remove all whitespace from string in JQuery?. Hear we will give you detail about How to remove all whitespace from string in JQuery?And how to use it also give you demo for it if it is necessary.

Sometimes we require to remove white space from given string. So at that time you can delete spaces from string using replace() of core php. replace() will help to replace your blank space or empty space or extra space or trailing space from string that way we can remove. you can do it from bellow example.

Example:

<html lang="en">

<head>

<title>Jquery - Remove white space from string</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>

</head>

<body>


<div >

This is my site.

</div>


<script type="text/javascript">

var myText = $(".mytext").text();

var newMyText = myText.replace(/ /g,'');

alert(newMyText);

</script>


</body>

</html>

Hope this code and post will helped you for implement How to remove all whitespace from string in JQuery?. 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 *

46  +    =  54

We accept paid advance and paid guest Posting on our Site : Contact US