Skip to content

Instantly share code, notes, and snippets.

@Tetsuro
Last active October 6, 2015 06:27
Show Gist options
  • Save Tetsuro/2950334 to your computer and use it in GitHub Desktop.
Save Tetsuro/2950334 to your computer and use it in GitHub Desktop.
jQuery for Terms and Conditions
<script type="text/javascript" charset="utf-8">
//<![CDATA[
// Including jQuery conditionnally.
if (typeof jQuery === 'undefined') {
document.write({{ "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" | script_tag | json }});
document.write('<script type="text/javascript">jQuery.noConflict();<\/script>');
}
//]]>
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".submit-cart input[type='submit'],.submit-cart input[type='image']").click(function(){
if(jQuery('#agree').is(':checked')){
jQuery(".submit-cart input").submit();
}
else{
alert("You must agree to the Terms and Conditions first");
return false;
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment