Advertisement
congdantoancau

[JS] Replace character

Dec 29th, 2017
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function(){
  2.     $("body").children().each(function () {
  3.         $(this).html( $(this).html().replace(/ơ/g,"ö") );
  4.         $(this).html( $(this).html().replace(/ư/g,"ü") );
  5.        
  6.        
  7.        
  8.         $(this).html( $(this).html().replace(/ả/g,"a^") );
  9.         $(this).html( $(this).html().replace(/ẳ/g,"ă^") );
  10.         $(this).html( $(this).html().replace(/ẩ/g,"â^") );
  11.         $(this).html( $(this).html().replace(/ẻ/g,"e^") );
  12.         $(this).html( $(this).html().replace(/ể/g,"ê^") );
  13.         $(this).html( $(this).html().replace(/ỉ/g,"i^") );
  14.         $(this).html( $(this).html().replace(/ỏ/g,"o^") );
  15.         $(this).html( $(this).html().replace(/ổ/g,"ô^") );
  16.         $(this).html( $(this).html().replace(/ở/g,"ö^") );
  17.         $(this).html( $(this).html().replace(/ủ/g,"u^") );
  18.         $(this).html( $(this).html().replace(/ử/g,"ü^") );
  19.         $(this).html( $(this).html().replace(/ỷ/g,"y^") );
  20.        
  21.         $(this).html( $(this).html().replace(/ạ/g,"a·") );
  22.         $(this).html( $(this).html().replace(/ặ/g,"ă·") );
  23.         $(this).html( $(this).html().replace(/ậ/g,"â·") );
  24.         $(this).html( $(this).html().replace(/ẹ/g,"e·") );
  25.         $(this).html( $(this).html().replace(/ệ/g,"ê·") );
  26.         $(this).html( $(this).html().replace(/ị/g,"i·") );
  27.         $(this).html( $(this).html().replace(/ọ/g,"o·") );
  28.         $(this).html( $(this).html().replace(/ộ/g,"ô·") );
  29.         $(this).html( $(this).html().replace(/ợ/g,"ö·") );
  30.         $(this).html( $(this).html().replace(/ụ/g,"u·") );
  31.         $(this).html( $(this).html().replace(/ự/g,"ü·") );
  32.         $(this).html( $(this).html().replace(/ỵ/g,"y·") );
  33.        
  34.         $(this).html( $(this).html().replace(/ắ/g,"ă´") );
  35.         $(this).html( $(this).html().replace(/ớ/g,"ö´") );
  36.         $(this).html( $(this).html().replace(/ứ/g,"ü´") );
  37.        
  38.         $(this).html( $(this).html().replace(/ằ/g,"ă`") );
  39.         $(this).html( $(this).html().replace(/ờ/g,"ö`") );
  40.         $(this).html( $(this).html().replace(/ừ/g,"ü`") );
  41.        
  42.  
  43.         $(this).html( $(this).html().replace(/ỡ/g,"ö~") );
  44.         $(this).html( $(this).html().replace(/ữ/g,"ü~") );
  45.        
  46.     });
  47. });
  48.  
  49. // Source: https://stackoverflow.com/questions/18643766/find-and-replace-specific-text-characters-across-a-document-with-js
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement