I have a Repeater (ASP.Net).
<asp:Repeater ID="rep" runat="server">
<ItemTemplate>
<asp:TextBox runat="server" ID="txt"></asp:TextBox>
<asp:CheckBox runat="server" ID="cb" />
</ItemTemplate>
I would like to write Text in the text-box if I click on the checkbox, using jQuery. Is this possible and how.
Yes, it is. One possibility is the approach by the server:
On the Load Event (in the server) of the CheckBox, you can do the following:
EDIT: It was missing the # in the jQuery selector.
Using jQuery, you can use the ID selector to select the DOM elements with the ID="txt" that you have specified. http://api.jquery.com/id-selector/
You can then update the .text() attribute of those elements. http://api.jquery.com/text/
Something like this should work in the simplest fashion:
I'd recommend simply using a CSS class and using that to identify the TextBox:
And then:
You'll have to post the html output to get a working code, but it is something like this: