jQuery event binding issues with radio buttons
<p>I'm trying to get jQuery to bind an onClick function when the document loads to my radio buttons.</p>

<p>ASP goes back to the database and finds all the open markers and then it sends a response to the page with the raw HTML to make a radio button and an image of the marker. What I need to do is have jQuery (or anything for that matter) bind an onClick that will signal what one is clicked so I can send that markerId back to the database to attach it to a person.</p>

<p>Here is a rough <a href="http://jsfiddle.net/sDAWQ/1/" rel="nofollow" title="jsFiddle">jsFiddle</a> of what I've tried so far. In debugging I added alerts in the each function and I see them 3x like I should but the <code>attr('id')</code> comes back undefined.</p>

<p>This is the html that puts the radio buttons on the form</p>

<pre><code>            &lt;br /&gt;
            &lt;p&gt;Select open marker for new user:
            &lt;% getMarkers(); %&gt;
            &lt;/p&gt;
</code></pre>

<p>This is the codebehind for that call</p>

<pre><code>        while (reader.Read())
        {
            if (readIndex % 3 == 0)
                markerTable += "&lt;tr&gt;";

            string markerId = reader["marker_id"].ToString();
            string fileName = reader["marker_filename"].ToString();

            markerTable += "&lt;td&gt;&lt;input type=\"radio\" name=\"openMarker\" value=\"" + markerId + "\" " +
                "id=\"oMrk" + markerId + "\"&gt;&lt;label for=\"oMrk" + markerId + "\"&gt;&lt;img src=\"/Markers/" +
                fileName + "\" /&gt;&lt;/label&gt;&lt;/input&gt;&lt;/td&gt;";

            readIndex++;

            if (readIndex % 3 == 0)
                markerTable += "&lt;/tr&gt;";

        }

        if (readIndex % 3 != 0)
            markerTable += "&lt;/tr&gt;";

        markerTable += "&lt;/table&gt;";
    }
    else
        markerTable = "&lt;p&gt;No empty markers. Please delete a user to continue.&lt;/p&gt;";

    sCon.Close();
    return markerTable;
</code></pre>

<p>The fiddle I posted has the source pasted into it from this function.</p>

<p>I have two questions.</p>

<ol>
<li>Why does this not work? It seems like it should, I am getting 3 elements from my jQuery selector statement, It's being called from <code>$(document).ready()</code> why are the attributes undefined?</li>
<li>Is there a better way to do this? I was planning on putting the value in a page variable and then sending it with an ASP button back to the server to a stored procedure to add that marker with some text from another field back to the database. I realize I could add the onClick event into the response html, but dang it I need to understand why what I'm doing isn't working.</li>
</ol>

<p>I'm pretty new to web, so if I am way off the mark procedurally, I am open for suggestion.</p>
