html - Making One checkbox mandatory out of four checkbox in jquery -
i have 4 checkbox, want user should alteast check 1 checkbox submitting form. please see checkbox html reference.
<asp:checkbox id="chkcroploan" runat="server" cssclass="check" onclick="javascript:enabletextbox();" /> <asp:checkbox id="chkinvestmentloan" runat="server" cssclass="check" onchange="javascript:enabletextbox();" />
let me know if can in jquery on button click event. see button html code
<asp:button id="btnsubmit" runat="server" text="submit" cssclass="button-form" width="100" onclick="btnsubmit_click" causesvalidation="true"/>
yes can accomplish on button click.
javascript code:
function validatechecked() { var cnt = $('.check').is(':checked').length; if (cnt > 0) { // } else { // else } };
html code:
<div> <input type="checkbox" class="clcheck" value="one" /> <input type="checkbox" class="clcheck" value="two" /> <input type="button" value="click me" onclick="validatechecked();" /> </div>
let me know if have questions.
jquery html checkbox
No comments:
Post a Comment