I want to have a generic .js file which, for each `form` it encounters on a page, on submit, it strips HTML from all `textarea`, `input` and `select` elements. I feel like I'm missing a basic trick.

```
$("form").each(function() {
    $(this).find(':input')
    if (!isNaN(this.value)) {
        this.value = this.value
            .replace(/&/g, "&amp;")
            .replace(/</g, "&lt;")
            .replace(/>/g, "&gt;")
            .replace(/"/g, "&quot;")
            .replace(/'/g, "&#039;");
    }
});

```