Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
there is a textbox in a form , when user provides ? into that field , it doesn't allow me to submit the form. So i am trying to convert that question mark by its ascii value. i tried to replace , all the other character were being replaced by its ascii value but i couldn't able to replace ? by its ascii value.
so any help?
Posted

1 solution

You do not need to replace with ascii values. You can just use the escape function.

JavaScript
var values = escape('?');


Aftewards, values will equal "%3F"
 
Share this answer
 
v2
Comments
Purushottam Prajapati 17-Apr-12 8:20am    
but i ve to retrive that value later so i just need to replace that ? with its asciii value
ZurdoDev 17-Apr-12 8:25am    
If you need to retrieve it in JavaScript, just use unescape(). This is a very common problem. There is no need to overdo it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900