Blankman
Blankman

Reputation: 267020

Javascript onclick and escapes

If my onclick event looks like:

<input .... onclick="someEvent('blah', '/some/folder/?a=1')" />

Should the ? character be escaped?

Upvotes: 1

Views: 50

Answers (2)

Robert
Robert

Reputation: 21388

In your simplified example it's fine as is. It's no different than passing it a question, ie What is for dinner?

Upvotes: 1

Oded
Oded

Reputation: 499002

For the purpose of passing the string parameter to someEvent, you don't need to escape the ?.

How you use the parameter in the event handler is another question, though on a URL it should be fine.

Upvotes: 1

Related Questions