lantervj
asked on
Removing apostrophes from a string
Pretty simple stuff. I just don't see the problem. If I remove all ScanLastName code it works (remove spaces).
var scandoc = '';
var ScanDoc1 = '';
var ScanDocFileName = '';
var ScanLastName = "212227_O'Connell".replace (/'/g, '');
var TheDivToRefresh = '';
function btnScan_onclick(divToRefre sh)
{
ScanDoc1 = $('input.scandocument').va l();
ScanDoc = ScanDoc1.replace(/\s/g, '');
ScanDocFileName = ScanDoc+ScanLastName;
}
var scandoc = '';
var ScanDoc1 = '';
var ScanDocFileName = '';
var ScanLastName = "212227_O'Connell".replace
var TheDivToRefresh = '';
function btnScan_onclick(divToRefre
{
ScanDoc1 = $('input.scandocument').va
ScanDoc = ScanDoc1.replace(/\s/g, '');
ScanDocFileName = ScanDoc+ScanLastName;
}
ASKER
I get btnScan_0nclick is undefined. If I remove all ScanLastName code it works fine.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It was caused by another statement;
$("div.filenameClass").htm l("The file name will be: '+str+'_#indivnum#_#lastna me#.pdf');
I had to change the escape apostrophes with quotes. The pound signs are Coldfusion variables. The new statement is;
$("div.filenameClass").htm l("The file name will be: "+str+"_#indivnum#_#lastna me#.pdf".r eplace(/'/ g, ''));
$("div.filenameClass").htm
I had to change the escape apostrophes with quotes. The pound signs are Coldfusion variables. The new statement is;
$("div.filenameClass").htm
function btnScan_onclick(divToRefre
{
ScanDoc1 = $('input.scandocument').va
ScanDoc = ScanDoc1.replace(/\s/g, '');
ScanDocFileName = escape(ScanDoc+ScanLastName);
}