Find Control in repeater dynamically with Jquery
<p>I have hard time to find textbox values in my repeater control. On button click i need to get textbox value corresponding to textbox which are inside of button which is clicked. </p>

<p>So i have : </p>

<p>Textbox1  ---> which have to be bound with Button1
TextBox2 ----> which is bound with Button2</p>

<pre><code>&lt;span&gt;Question :&lt;/span&gt;&lt;span&gt;my second content &lt;br /&gt;&lt;/span&gt;&lt;span&gt;Answer : &lt;/span&gt;&lt;input name="ctl00$MainContent$ctl00$ctl00$TextArea" type="text" id="MainContent_ctl00_TextArea_0" value="6454" /&gt;
</code></pre>

<p>Add Question<hr /></p>

<p>Question :abcdedf <br />Answer : Add Question</p>

<p>Right now i have jquery function which get which is clicked:</p>

<pre><code> $(".addAnswerButton").click(function () {

        //var quantityBox = $("#TextArea", $(this).parent());
        var tr = $(this).closest("text")
        alert(tr.val());
        //quantityBox.text = "Hello there";
        //var currentValue = quantityBox.val();
        $(this).siblings('input[type="text"]').first().val("clicked");

        //quantityBox.val(parseInt(currentValue) + 1);
    });
</code></pre>

<p>Ive got it working partially with: </p>

<pre><code>$(this).siblings('input[type="text"]').first().val("clicked");
</code></pre>

<p>Where i get set textbox text, but then again, if i click second button, nothing happends.</p>

<p>What an i doing wrong? How can i get value from specific textbox? </p>

<p><strong>UPDATE</strong></p>

<p>now i go with solution where i add custom attribute to each control: </p>

<pre><code>    &lt;span&gt;Question :&lt;/span&gt;
&lt;span&gt;my second content &lt;br /&gt;&lt;/span&gt;
&lt;span&gt;Answer : &lt;/span&gt;
&lt;input name="ctl00$MainContent$ctl00$ctl00$TextArea" type="text" id="MainContent_ctl00_TextArea_0" value="654" mydataid="2" /&gt;

    &lt;button id="MainContent_ctl00_answerQuestion_0" Class="addAnswerButton" onclick="Click()" mydataid="2" &gt;Add Question&lt;/button&gt;&lt;hr /&gt;&lt;span&gt;Question :&lt;/span&gt;&lt;span&gt;abcdedf &lt;br /&gt;&lt;/span&gt;

    &lt;span&gt;Answer : &lt;/span&gt;&lt;input name="ctl00$MainContent$ctl00$ctl01$TextArea" type="text" mydataid="1" id="MainContent_ctl00_TextArea_1" value="654" /&gt;

    &lt;button id="MainContent_ctl00_answerQuestion_1" Class="addAnswerButton" onclick="Click()" mydataid="1"&gt;Add Question&lt;/button&gt;​
</code></pre>

<p>So right now i can get custom atribute from onclick event by doing this: </p>

<pre><code>$(".addAnswerButton").click(function() {
    var pos = $(this).attr("mydataid");
    alert(pos);
 //   $(this).siblings('input[type="text"]').first().val("clicked");
});
</code></pre>

<p>But how do  i get textbox control which have samme custom attribute name as button? </p>

<p><strong>Update 2</strong></p>

<p>After 70 tryes i finally figured it out (my first tryes with Jquery)</p>

<p><strong>solution</strong> </p>

<pre><code>$(".addAnswerButton").click(function() {
    var pos = $(this).attr("mydataid");
    results = $('input[type = "text"][mydataid="'+pos+'"]').first();
    alert(results.val());
});
</code></pre>

<p>So point is, you are getting custom attributes "name", and then searching for a textbox with same attribute name. </p>
