title: KeyPress Event not working in asp.net Content Page
body: <p>Following is my code.can anyone please tell me how to handle keypress event in asp.net content page</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function () {
      $('#txtdesc').keypress(function (e) {
          var txt = $(this).val();
          if (txt.length &gt; 5) {
              e.preventDefault();
          }
      });
  });
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;asp:TextBox ID="txtdesc" TextMode="MultiLine" runat="server" &gt;&lt;/asp:TextBox&gt;
  </code></pre>