jquery with check box in asp.net adding click event
<p>I have textbox and checkbox in asp.net page.
if the check box checked should have an input mask and if its uncheck should have another input mask. my code is always picking up second condition and I've been advised that I should add click event to run the code whenever the checkbox is clicked and because I'm new with jquery i need help to add click event to my script.</p>

<p>please help.</p>

<p>here is my code:</p>

<pre><code> &lt;%@ Page Title="" Language="C#" MasterPageFile="~/Imam.Master" AutoEventWireup="true" 
    CodeBehind="WebForm4.aspx.cs" Inherits="Imam_Contacts.WebForm4" %&gt;
 &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;

 &lt;script src="js/jquery-1.4.1.js" type="text/javascript"&gt;&lt;/script&gt;


&lt;script src="js/jquery.maskedinput-1.2.2.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;



  $(function() {
 if ($('#chkhtml:checked').length &gt; 0) {
   $("#txthtml").mask("999-99-9999");
  } else { 
   $("#txthtml").mask("99/99/9999");
  }
 }); 

&lt;/script&gt;


&lt;/asp:Content&gt;
&lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
</code></pre>

<p></p>

<pre><code>&lt;input id="chkhtml" type="checkbox" checked="checked" /&gt;

 &lt;/asp:Content&gt;
</code></pre>
