/lib/jquery-validate/demo/captcha/captcha.js
JavaScript | 27 lines | 25 code | 2 blank | 0 comment | 0 complexity | 02a6ed487354e9161f816f0c269c4819 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
- $(function(){
- $("#refreshimg").click(function(){
- $.post('newsession.php');
- $("#captchaimage").load('image_req.php');
- return false;
- });
-
- $("#captchaform").validate({
- rules: {
- captcha: {
- required: true,
- remote: "process.php"
- }
- },
- messages: {
- captcha: "Correct captcha is required. Click the captcha to generate a new one"
- },
- submitHandler: function() {
- alert("Correct captcha!");
- },
- success: function(label) {
- label.addClass("valid").text("Valid captcha!")
- },
- onkeyup: false
- });
-
- });