• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with special characters in javascript

 
Sanjaykar Gurram
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am having issue passing text containing special characters to a javascript function. Would like to know if there is any special means to pass text like this.

Ex: onclick="loadPopup('My Saloon's Test')" <----- Text having special character( ' )

If i do this it shows script error "Expected )".

Please let me know how do i handle this.


Thanks,
Sanjay
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For future reference, there is a HTML and JavaScript forum that you should use instead of this one. Special characters need to be escaped. Traditionally the escape character is backslash. Try the following
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64832
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the HTML forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic