Last active
October 31, 2016 11:19
-
-
Save 0vulns/63d5dcb10604cec132e03719b7871855 to your computer and use it in GitHub Desktop.
a jQuery method to replace text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.replace = function (a, b) { | |
this.text(this.text().replace(a, b)); | |
return this.text(); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Definition and Usage
The $.replace() method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
This method change the original string.
Syntax
Parameter Values