Often times when signing up for a new service or such you must accept the site's terms and conditions. Until you explicitly check that you agree, you are not allowed to submit the web page. Here is an easy way to do this using jQuery. You just have to change some attributes on your button to enable/disable. For more info see the jQuery documentation. Note that the user will still be able to submit the page if JavaScript is disabled.
Demo | Download
Disabled:
Enabled:
JavaScript Disabled:
jQuery:
$(document).ready(function() {
$("#ButtonAcceptTerms").attr("disabled", "disabled");
$("#CheckBoxTerms").click(function() {
var checked_status = this.checked;
if (checked_status == true) {
$("#ButtonAcceptTerms").removeAttr("disabled");
}
else {
$("#ButtonAcceptTerms").attr("disabled", "disabled");
}
});
});
ASP.NET:
<asp:CheckBox ID="CheckBoxTerms" runat="server" />
I accept the terms and conditions.
<div class="submitDiv">
<asp:Button ID="ButtonAcceptTerms" runat="server" Text="Submit" />
</div>
Hope this helps someone :)