I have a input field with plus icon. On clicking the plus icon the input's value gets added above the input field.
Actually I am using a template for adding content above the input field. On clicking plus icon I replace the respective patterns with values and place the content above input field using jQuery replace function.
If any hacker inputs values like "<script>alert("hi");</script>"
the layout breaks.
How can I block these type of attacks via jQuery? I know server side validations can be done. But is there any way we can block these attacks via jQuery/client side validation?