Remove Special Characters From String jQuery

In this quick example, I will show you remove special characters from string javascript jquery. From this example, you will learn remove special characters and space from string javascript. In this tutorial, i will explain and i will share the source code of javascript remove special characters from beginning of string.

I will give you a very simple and short example of how to remove all special characters from string in jquery. we will use replace function to remove all special characters from text. so, let's run the below html file.

$(document).ready(function () {
   myString = "Hi, code$%#cheef@@@";
   newString = myString.replace(/[^\w\s]/gi, '');


Read also: Allow Only Text Input Type Text in JavaScript


Now you can test. Hope it can help you.


Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js