Remove Comma from String in JQuery

Posted by


Hey there! Are you struggling with removing commas from strings in JQuery? Well, you’ve come to the right place! In this blog post, I’ll guide you through the process of removing those pesky commas from your strings using JQuery.

Why Remove Commas?

Before we dive into the solution, let’s quickly talk about why you might want to remove commas from a string. One common scenario is when you’re dealing with data that includes numbers with commas as separators, such as currency values. Removing the commas allows you to perform calculations or manipulate the data more easily.

Step: Create a html page

<html lang="en">
  <title>Jquery remove comma from string</title>
  <script src=""></script>

<script type="text/javascript">

    $(document).ready(function() {

      var myStr = "Hi, Roshan. How are you?";
      myStr = myStr.replace(/,/g, "");




The JQuery Solution

Now, let’s get down to business. Here’s a simple JQuery code snippet that will help you remove commas from a string:

var myStr = "Hi, Roshan. How are you?";
myStr = myStr.replace(/,/g, "");


Hopefully, It will help you …!!!

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x