This is the function that I have
function set(sub) {
var input = prompt("Insert your desired " + sub + " information, leave blank if you use an automated system to generate this information.");
$('#' + sub).html(input).show();
var textarea = $('textarea');
textarea.html(textarea.html().replace(sub+"=",sub+"="+input));
}
Usually the sub is s1, or s2, or s3. Now the issue is that I want the replaced value to reset if the input is blank.
So lets say I input that I want to set s1 to equal a, so in the text area it will replace s1= with, s1=a, now if the input is empty I want the s1=a to revert back to s1=
How about this? It uses a regular expression (Regex) to do the replacements.