I have a function which takes a value from query strings and puts it inside a p element:
var globalCodice = querystring('codice');
var globalCodiceTesto = globalCodice.valueOf();
var myOfferta = $('#currentOfferta');
$('#currentOfferta').text(globalCodiceTesto); //THIS DOES NOT WORK
where globalCodice is the queryString, obtained from this method:
function querystring(key) {
var re=new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi');
var r=[], m;
while ((m=re.exec(document.location.search)) != null) r.push(m[1]);
return r;
}
markup:
<!-- header -->
<div id='titleHeader' class='header'>
<h3>Dettaglio Offerta</h3>
<p id='currentOfferta' style='color:white !important'>OMFG</p>
</div><!-- /header -->
But in the end the text never gets changed. I’ve tried different things and nothing seems to work. Does anyone have something to share with me in order to make this work?
edit: globalCodice and globalCodiceTesto are retrieved correctly, as the p element. The only thing that does not work is the .text() line.
Does
return
String? What happens if you do?