I have a repeater with checkboxes for every item. I want to only have one checked at a time.
The checkboxes is asp:checkbox, don't know if it makes any difference. I tried with some jquery but it doesn't seem to work.
<asp:Repeater runat="server" DataSourceID="SqlDataSource1" ID="repeater1">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" Checked='<%# Eval("carousel_check")%>'/>
</ItemTemplate>
</asp:Repeater>
I have tried to give the checkbox a cssclass (checked_button) and then this script.
$(document).ready(function () {
$('.checked_button').change(function () {
if ($(this).is(':checked')) {
$('.radio-similar').not(this).removeAttr('checked');
};
});
});
Aucun commentaire:
Enregistrer un commentaire