get id for element that was clicked
<p>How do I get the id of the element that was clicked when I have a function like this?</p>

<pre><code>$("#btnOne, #btnTwo").on("click", "input.select", function () {    
</code></pre>

<p>I tried:</p>

<pre><code>this.id;
</code></pre>

<p>and </p>

<pre><code>$(this).attr("id");
</code></pre>

<p>Here is the html </p>

<pre><code>&lt;div id="TransferOwnershipBox" title="Transfer Ownership"&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td&gt;
                &lt;asp:TextBox ID="tbSearchField" Text="Search..." ClientIDMode="Static" Width="400px" runat="server" CssClass="text ui-widget-content ui-corner-all"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;input type="button" id="btnSearch" data-str="tblOwnerSearchResults" value="Search" Class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table id="tblOwnerSearchResults" data-str="ownerId" data-dataItem="id" style="border: none; width: 100%; padding: 2px;"&gt;&lt;/table&gt;
&lt;/div&gt;


&lt;!-----COURSE DIRECTOR-----&gt;
&lt;div id="CourseDirectorBox" title="Directors"&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td&gt;
                &lt;asp:TextBox ID="tbDirector" Text="Search..." ClientIDMode="Static" Width="400px" runat="server" CssClass="text ui-widget-content ui-corner-all"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;input type="button" id="btnDirectorSearch" data-str="tblDirectorSearchResults" value="Search" Class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table id="tblDirectorSearchResults" data-str="source" data-dataItem="DisplayName" style="border: none; width: 100%; padding: 2px;"&gt;&lt;/table&gt;              
&lt;/div&gt;
</code></pre>

<p>But I am not getting any id from either.</p>

<p>Thanks</p>
