title: Sanitising user input to prevent XSS
body: <p>An internal web application I have developed will be pen tested soon.  It uses Windows Authentication.</p>
  
  <p>It has quite a lot of AJAX.  I was reading about cross site scripting recently: <a href="https://en.wikipedia.org/wiki/Cross-site_scripting" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Cross-site_scripting</a></p>
  
  <p>The article talks about sanitizing user input.  Is there a function that will do this in JavaScript/Jquery?</p>
  
  <p>For example, if the user enters: <code>&lt;script type='text/javascript'&gt;alert('xss');&lt;/script&gt;</code>, then how can I sanitise this? To prevent SQL Injection attacks you use command parameters, which are built in to .NET.</p>
  
  <p>I could replace the inappropriate tags myself, however I just wanted to make sure there was not a built in way of doing this first.  I have spent some time Googling, but I have not found an answer to my specific question.  </p>