Return to Snippet

Revision: 48081
at June 23, 2011 07:31 by zackfern


Updated Code
function random_between(to, from) {
	return Math.floor(Math.random() * (to - from + 1) + from);
}
$(document).ready(function() {
	var num1 = random_between(0,5)
	var num2 = random_between(5,10);
	$('label[for="captcha"]').text("What is "+num1+" + "+num2);
	$('form').submit(function() {
		if($('#captcha').val() == (num1+num2)) {
			$('form').submit();
		}
		else {
			alert("Your CAPTCHA IS NOT valid!");
			return false;
		}
	});
});

Revision: 48080
at June 23, 2011 07:30 by zackfern


Initial Code
function random_between(to, from) {
				return Math.floor(Math.random() * (to - from + 1) + from);
			}
			$(document).ready(function() {
				var num1 = random_between(0,5)
				var num2 = random_between(5,10);
				$('label[for="captcha"]').text("What is "+num1+" + "+num2);
				$('form').submit(function() {
					if($('#captcha').val() == (num1+num2)) {
						$('form').submit();
					}	else {
						alert("Your CAPTCHA IS NOT valid!");
						return false;
					}
				});
			});

Initial URL


Initial Description


Initial Title
Addition CAPTCHA

Initial Tags


Initial Language
jQuery