Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
XSS prevention on an HTML textbox the returns javascript/ajax results

There is an HTML input textbox that has id paramater of exampleId. When something is submitted in this textbox and then submitted a javascript/ajax call is made and the correct results are returned. Cross-site scripting is needed on this textbox so I added into the javascript:

testVal=htmlEncode($('#exampleId').val());
$('#exampleId').val(testVal);

That works. Its prevents any cross-site scripting attacked. But the problem I am now having is if someone enters the following example: hello? It updates the value in the textbox to hello&#63 which I do not want.

Is there a better way to prevent cross-site scripting or is there a way I can also decode the value in the textbox so it would still display hello? while still keeping the above xss prevention?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!