I have a textarea in which I have put validation code not to allow <script>
tags and Javascript tags, but the user can enter descriptions like <strong onmouseover=alert(2)>
.
So when someone hovers over this string tag JS alert box shows up.
How can I stop this kind of javascript injection?
There are a lot of tools called html purifiers. You can try this for example.