JQuery: I have a unique id for my form. How do I use that to select the element ids within it?
<p>I have a form and I generate a unique Id for it. The idea is that if more than 1 form is generated, the duplicate ids on each form will not interfere with each other because I can reference the unique form Id for the first.
However what I want to know is the syntax for doing this.
So on the following View, I have some jquery script that reference a date field and a couple of checkboxes. As currently written, where I create more than 1 form, the Id for  NullableOtherLeaveDate, MorningOnlyFlag, AfternoonOnlyFlag will be duplicated. I need to prefix them with the unique formId.</p>

<pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl&lt;SHP.Models.EmployeeOtherLeaf&gt;" %&gt;
&lt;% var unique = DateTime.Now.Ticks.ToString(); %&gt;
&lt;script language="javascript" type="text/javascript"&gt;
    $(document).ready(function () {
        $('#NullableOtherLeaveDate').datepicker({ dateFormat: 'dd-MM-yy' });
        $('#MorningOnlyFlag').click(function () {
            $('#AfternoonOnlyFlag').attr('checked', false);
        })
        $('#AfternoonOnlyFlag').click(function () {
            $('#MorningOnlyFlag').attr('checked', false);
        })
    });

    var options = {
        target: '#frmAddAbsenceOneDay&lt;%= unique %&gt;',
        success: RefreshList
    };

    $(document).ready(function () {
        $('#frmAddAbsenceOneDay&lt;%= unique %&gt;').ajaxForm(options);
    });

&lt;/script&gt;

&lt;div id="AddAbsenceOnDay&lt;%= unique %&gt;"&gt;

    &lt;% using (Html.BeginForm("AddAbsenceOneDay", "Employee", FormMethod.Post,
           new { id = "frmAddAbsenceOneDay" + unique }))
       { %&gt;
        &lt;%: Html.ValidationSummary(true) %&gt;
        &lt;fieldset&gt;
            &lt;legend&gt;Add an absence for a day or half day&lt;/legend&gt;
            &lt;table&gt;
                &lt;tr&gt;
                    &lt;td&gt;&lt;%: Html.LabelFor(model =&gt; model.OtherLeaveId)%&gt;&lt;/td&gt;
                    &lt;td&gt;
                &lt;%: Html.DropDownListFor(model =&gt; model.OtherLeaveId, Model.SelectLeaveTypeList, "&lt;--Select--&gt;")%&gt;
                &lt;%: Html.ValidationMessageFor(model =&gt; model.OtherLeaveId)%&gt;                    
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                &lt;%: Html.LabelFor(model =&gt; model.NullableOtherLeaveDate)%&gt;                    
                    &lt;/td&gt;
                    &lt;td&gt;
                &lt;%: Html.EditorFor(model =&gt; model.NullableOtherLeaveDate)%&gt;
                &lt;%: Html.ValidationMessageFor(model =&gt; model.NullableOtherLeaveDate)%&gt;
                &lt;%if (ViewData["ErrorDateMessage"] != null &amp;&amp; ViewData["ErrorDateMessage"].ToString().Length &gt; 0)
                  { %&gt;   
                                   &lt;p class="error"&gt;
                   At &lt;% Response.Write(DateTime.Now.ToString("T")); %&gt;. &lt;%: ViewData["ErrorDateMessage"]%&gt;.
                &lt;/p&gt;
                &lt;%} %&gt;                 
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                &lt;%: Html.LabelFor(model =&gt; model.MorningOnlyFlag)%&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                &lt;%: Html.CheckBoxFor(model =&gt; model.MorningOnlyFlag)%&gt;
                &lt;%: Html.ValidationMessageFor(model =&gt; model.MorningOnlyFlag)%&gt;                        
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                &lt;%: Html.LabelFor(model =&gt; model.AfternoonOnlyFlag)%&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                &lt;%: Html.CheckBoxFor(model =&gt; model.AfternoonOnlyFlag)%&gt;
                &lt;%: Html.ValidationMessageFor(model =&gt; model.AfternoonOnlyFlag)%&gt;                     
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;

            &lt;p&gt;
                &lt;span style="padding-right:10px;"&gt;&lt;input type="submit" value="Create" /&gt;&lt;/span&gt;&lt;input type="button" value="Close" onclick="closeTab()" /&gt;
            &lt;/p&gt;
        &lt;/fieldset&gt;

    &lt;% } %&gt;
    &lt;/div&gt;
</code></pre>
