Javascript code to overcome XSS vulnerability

This project received 9 bids from talented freelancers with an average bid price of $27 USD.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
$10 - $30 USD
Total Bids
Project Description

I need javascript code which escapes the data before placing it into HTML page to prevent XSS vulnerability.

Situation: Website visitor enters text to a field on website. The website saves it into database. Later websites renders the text directly in HTML causing XSS vulnerability.
Solution: Escape the text using javascript before rendering it in HTML. However I have no code to do this. Please write quality code sample.

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online