,

Remove All Numbers from String

Posted by

Let’s explore how to use jQuery to remove all digits from a string in this brief example. You may comprehend the idea of using jQuery to delete all digits from a string. Learn how to remove every number from a string using jQuery. This post goes into great detail about removing all numbers from a jQuery string.

I’ll give you a quick and easy example of how to use jQuery to remove all digits from a string. To eliminate every number from the text, we shall utilize the replace function. Now let’s execute the HTML file below.

Example:

Index.html

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
</head>
<body>
  
</body>
  
<script type="text/javascript">
    $(document).ready(function () {
  
        myString = "Hi, It 123 abhishek 456";
        newString = myString.replace(/\d+/g, '');
  
        console.log(newString);
  
    });
</script>
  
</html>

Output:

Hi, It abhishek

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x