how to validate input text to ignore special characters

How can i validate input to stop users from add special characters like html code or any code for security wise 

example:

        <tr>
            <td>WX - WEATHER</td>
            <td>a1</td>
        </tr>
        <tr>
            <td>SFC VIS - SURFACE VISIBILITY</td>
            <td>a2</td>
        </tr>

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data