How To Escape Html Characters In Javascript For Eval()
- Forums
- Javascipt
- How To Escape Html Characters In Javascript For Eval()
this is how i was able to overcome and fix trying to use HTML characters while sending it to the eval function in javascript [846], Last Updated: Sat May 18, 2024
wallpaperama
Sun Apr 22, 2012
0 Comments
415 Visits
today i was working on a script which required me to run some html code but i was using the eval() function in javascript and jquery to execute the command. i tried several things..
i tried using the backlash \\ - that didint work
if you go to http://stackoverflow.com/questions/3830163/how-to-escape-special-characters-within-eval-using-javascript
it tells u to use " instead of \\"
i tried using " instead of \\" but that only worked on Firefox and Chrome, but not Internet Explorer
so what finally worked? well, i was using php to generate the HTML code so i simple used the function, and it coverted all the HTML code to be used by the eval() function in javascript.
hope that helps anyone