in the following example I am trying to replace all instances of the newname
variable with -
,
however newname
in my example is handled as text, rather than a as variable.
var newname = 'test';
var lastname = $(this).attr('name').replace(/newname/g, "-");
Can anyone help out?