Pages

Friday, 4 November 2011

Double mouse-click event for RadioButtonList

The following jquery script will uncheck the selected radio button item when double clicking on it.



<asp:RadioButtonList ID="RadioButtonList1" runat="server">
    <asp:ListItem Text="One" Value="1"></asp:ListItem>
    <asp:ListItem Text="Two" Value="2"></asp:ListItem>
    <asp:ListItem Text="Three" Value="3"></asp:ListItem>
</asp:RadioButtonList>
<script type="text/javascript" src="Scripts/jquery-1.4.2-vsdoc.js"></script>
<script type="text/javascript">          
    $(document).ready(function () {
        $('#<%= RadioButtonList1.ClientID %>').dblclick(function () {
            $('#<%= RadioButtonList1.ClientID %> input:radio:checked').each(function () {
                $(this).attr('checked', false);
            });
        });
    });        
</script>

No comments:

Post a Comment