Two Laptop Bag*
The moose likes HTML, CSS and JavaScript and the fly likes Java Script - Problem When data has apostrophe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Java Script - Problem When data has apostrophe" Watch "Java Script - Problem When data has apostrophe" New topic
Author

Java Script - Problem When data has apostrophe

Madhumathy Viswanathan
Greenhorn

Joined: Jun 01, 2005
Posts: 6
There is a link which calls the javascript function. This link passes a String (which has an apostrophe)as an input to the script. At this point, the javascript function is not called.If the input String to javascript function does not have apostrophe , then the method is called successfully!!

Kindly help me out how to handle inputs with apostrophe

Thanks in advance


Madhumathy
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It needs to be escaped "\" so it does not affect the string.

Eric
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41184
    
  45
Have you tried escaping the apostrophes, writing 'abc\"def" instead of 'abc"def'? It would be a good idea to do that for single quotes as well.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Script - Problem When data has apostrophe
 
Similar Threads
using replaceAll() function with jstl
Getting a String from a Javascript function call
retrieve value at servlet from javascript.
javascript: referrer unknown
need help with jquery autocomplete