Validating html tags in textbox – Cross site scripting

Following is the code to validate any textbox or input text against html tags.

//source and args are required if calling from custom validator in asp.net else its not required
function htmlValidation(source,args) 
{
var re = /(<([^>]+)>)/gi;

if (document.getElementById(’<%=TextBox2.ClientID%>’).value.match(re)) {
document.getElementById(’<%=TextBox2.ClientID%>’).value = “”;
alert(’Invalid content’);
//args.IsValid = false; // you can use this if you are calling this from custom validator in asp.net
return false;
}
if (document.getElementById("textboxid").value.match(re)) {
document.getElementById("textboxid").value = “”;
alert(’Invalid content’);
return false;
}
return true;
}