Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link using onclick and special chars

Status
Not open for further replies.

chrisw09

IS-IT--Management
Nov 23, 2005
22
US
I have the following link that calls a javacript function. This works perfectly fine unless the input value has a ' in it, for example Gary's books.

Code:
<a href="#" onclick="rename('test');">

I tried using encodeURI in the onclick="" but the quotes are still causing me grief. I hope i'm explaining this well enough.

Any suggestions?
 
Sorry it's early, i should have explained better. the data is coming from a database. This is my actual url:

Code:
<a href="#" onclick="rename('${list.id}','${list.name}');">Rename</a>

I'm passing this to a javascript function that displays a form field for the user to rename the value and submit back to the database. Since the user is allowed to use any characters they want, the ' gives a javascript error.
 
That's what i ended up doing. i was hoping to do it all with javascript...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top