Need to only allow certain characters to be entered OR deleted
<p>I have a textbox. The only things I want the user to be able to enter are parentheses. They should also only be able to delete parentheses. I'm having a ton of trouble doing this though.</p>

<p>Right now I have a function like this:</p>

<pre><code>        '#myTextArea input': function (el, ev) {

        }
</code></pre>

<p>I used input so it would handle people pasting.</p>

<p>I'm not sure how to find the character typed from this though. I especially don't know how to make sure only a parentheses was deleted. Anyone know of a good way to do this?</p>

<p><strong>Edit</strong>
To clarify, the textbox is already populated with text. The user should just be able to add and remove parentheses to the text already there.</p>

<p><strong>Edit2</strong></p>

<p>I got it working so the user can ONLY enter parentheses. This does not take into account pasting, and does not deal with deleting. Still have no idea how to do that.....</p>

<pre><code>        '#myTextArea keydown': function (el, ev) {
            if ((ev.keyCode != 48 &amp;&amp; ev.keyCode != 57) || ev.shiftKey == false){
                return false;
            }
        }
</code></pre>
