actualizarTituloWeb('brand name - '+seccion.toLowerCase().replace(/(?:_| |\b)(\w)/g, function(str, p1) { return p1.toUpperCase()}));
where
function actualizarTituloWeb(titulo){
$( 'title' ).html ( titulo );
}
Also tried with:
function actualizarTituloWeb(titulo){
titulo = titulo[0].toUpperCase() + titulo.substring(1);
titulo = titulo.toLowerCase();
$( 'title' ).text ( titulo );
return false;
}
and seccion has values such as ‘reserva’, ‘ofertas’ , ..
I am not really sure why is not working but this actually makes the whole script crash (can be tested in live here: http://toniweb.us/gm2 ) in IE7 and the title of the current document is neither updated,
any idea what am i missing?
-EDIT-
Just realised that the problem is in this line! why?
titulo = titulo[0].toUpperCase() + titulo.substring(1);
Please note: We can not use CSS here to achieve this because it will be used for the document.title
In JScript <= 5.7 (IE 7) you cannot access a string like an array. You have to use
String.charAt()instead. Array-like access is standardized in ES 5.In addition
$('title').text(titulo);doesn’t work eighter. In IEs up to version 8 you cannot set (or get) the title by the textContent of the title-element.use document.title