I'm trying to do a replace
on a string like this:
$('#example_id').replace(/abc123/g,'something else')
But the abc123
actually needs to be a variable.
So something like:
var old_string = 'abc123'
$('#example_id').replace(/old_string/g,'something else')
So how would I use a variable in the replace function?