I need to modify the value using javascript, to make it ready to be put as part of a SQL insert query.
Currently I have the following code to handle the single quot
You should use a escape function provided by some kind of database library, rolling your own will only cause trouble.