Created
May 26, 2015 21:00
-
-
Save WilCF/1dd5a76558a1c5358f41 to your computer and use it in GitHub Desktop.
JQuery to disallow similar textbox input submissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['jquery-noconflict'], function(jQuery) { | |
//Ensure MooTools is where it must be | |
Window.implement('$', function(el, nc){ | |
return document.id(el, nc, this.document); | |
}); | |
var $ = window.jQuery; | |
$(document).ready(function(){ | |
$("input.submit").click(function(e){ | |
var bad_answers = false; | |
$(".cml.jsawesome").each(function() { | |
var one = $(this).find('input.one'); | |
var two = $(this).find('input.two'); | |
if($(two).val().length > 0 && $(one).val().length > 0){ | |
if ($(one).val() === $(two).val()) { | |
bad_answers = true; | |
} | |
} | |
}) | |
if (bad_answers) { | |
alert('Values Should Not Match'); | |
return false; | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment