I try to replace special characters I’ve defined which are contained on all my < h2 >
I’ve wrote this piece of code but it still not work.
var charMap = {
à:'a',è:'e',é:'e',ä:'a',ë:'e',
ö:'o',â:'a',À:'A',É:'E',È:'E',
};
$('h2').each(function() {
var str = $(this).text() ;
var str_array = str.split('');
for( var i = 0, len = str_array.length; i < len; i++ ) {
str_array[ i ] = charMap[ str_array[ i ] ] || str_array[ i ];
};
});
Thanks for helping newbie like me 🙂
You’ll have to actually set the new value too:
where the builtin function
Array.joinis effectively the “inverse” ofString.split.