Uncaught SyntaxError: missing) after argument list

-5

Well I'm having an error in my javascript can anyone help?

'<a id="showData" onclick="OpenDescriptionModal(\''+ postData[0].replace('#', '') + '\', \'' + editTitle + '\', \''+ description.replace(/"/g, '\'') +'\');" class="btn btn-success" title="View" lang="en" style="margin-top: 5px;"><i class="fa fa-eye iconInsideBtn" aria-hidden="true"></i><span>View</span></a><a style="margin-left: 1em; margin-top: 5px;" onclick="openEditModal(\''+ postData[0].replace('#', '') + '\', \'' + editTitle + '\', \''+ description.replace(/"/g, '\'') +'\');" class="btn btn-success" title="Edit" lang="en"><i class="fa fa-edit iconInsideBtn" aria-hidden="true"></i><span lang="en">Edit</span></a><a style="margin-left: 1em; margin-top: 5px;" onclick="openDeleteModal(\''+ postData[0].replace('#', '') +'\');" class="btn btn-danger" title="Delete" lang="en"><i class="fa fa-times-circle iconInsideBtn" aria-hidden="true"></i><span lang="en">Delete</span></a>' 
    
asked by anonymous 22.06.2018 / 17:33

1 answer

0

Exchange All

description.replace(/"/g, '\'') 

by

description.replace(/["']/g, '\\'')

Your leather will be safe and you can sleep the sleep of Morpheus.

    
22.06.2018 / 17:59