Limiting the input for all the textboxes to 2 digits(0-99), whose ID contains a certain text or has specific class. (jQuery)
<p>I have two sets of textboxes which are generated dynamically. All these textboxes has either (<code>**textnormal**</code> or <code>**textnormalHS**</code>) as <strong>class name</strong> and all of them have a specific text ("txtMem") as part of their <strong>ID</strong>.
I want to limit the no of characters to be displayed in the texbox to 2.</p>

<pre><code>$("input[type='text'][id*='txtMem']").keyup(function () {
    var $this = $(this);
    if ($this.val().length &gt; 2) $this.val($this.val().substr(0, 2));
});
</code></pre>

<p>doesn't seem to be working.</p>
