Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery replace multiple words

// jQuery search and replace space in 10 digit phone number with dots (.)
(".some-class").each(function() {
            var text = $(this).html();
  // Start search at "Phone: " then 3 digits space 3 digits space 4 digits
  // "Phone: 901 123 4567" -> "Phone: 901.123.4567"
            text = text.replace(/Phone: (d{3}) (d{3}) (d{4})/, "Phone: $1.$2.$3");
            $(this).html(text);
        });
Comment

PREVIOUS NEXT
Code Example
Javascript :: express post 
Javascript :: element.js 
Javascript :: add class to html tag javascript 
Javascript :: connect to existing collection mongoose 
Javascript :: convert integer month to string month react native 
Javascript :: get file css code with javascript 
Javascript :: add word in string in javascript 
Javascript :: if () { } 
Javascript :: new date javascript invalid date 
Javascript :: range number in js 
Javascript :: Aug 25 2020 00:00:00 GMT+0530 
Javascript :: javscript rename property name 
Javascript :: defining schema mongoose 
Javascript :: what is a block in javascript 
Javascript :: await fetch parameters 
Javascript :: sort in array in javascript 
Javascript :: You need to inject a global window.jQuery first. 
Javascript :: react pass object as props 
Javascript :: custom processing datatables 
Javascript :: react-native-bouncy-checkbox 
Javascript :: how to use post method in react 
Javascript :: alternative way to handle React routes in a separate file 
Javascript :: create a customer in stripe node.js 
Javascript :: remove last character of string in javascript 
Javascript :: angular mat radio group select index 
Javascript :: @output() angular 
Javascript :: sort object with certain value at start of array js 
Javascript :: how to remove whitespace in javascript 
Javascript :: google translate javascript 
Javascript :: react router dom default params 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =