I have a simple string of code. I want to show a default value when the page is loaded where the function numResults() is. At some point I want to update numResults() with a new value and then change the string without reloading the page.
$('#step1').before('Showing results 1 - ' + numResults());
function numResults(value) {
var results = 10; // default number
if (value) {
return value; // show updated value
} else {
return results; // show default
}
}
I think you can utilize a
jQuery.Callbacksobject for this: