Last active
May 29, 2016 04:49
-
-
Save jhmt/9b848fab863fd67c7ec5edb267366c64 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>Code Kata Session 26/05/16</title> | |
<script src="https://code.jquery.com/jquery-2.2.4.min.js" ></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$('input').change(function(){ | |
var changed = this; | |
$(this).siblings().map(function(index, input){ | |
input.checked = ((input.value % changed.value) === 0)? changed.checked : input.checked; | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<input type="checkbox" value="1" />1 | |
<input type="checkbox" value="2" />2 | |
<input type="checkbox" value="3" />3 | |
<input type="checkbox" value="4" />4 | |
<input type="checkbox" value="5" />5 | |
<input type="checkbox" value="6" />6 | |
<input type="checkbox" value="7" />7 | |
<input type="checkbox" value="8" />8 | |
<input type="checkbox" value="9" />9 | |
<input type="checkbox" value="10" />10 | |
<input type="checkbox" value="11" />11 | |
<input type="checkbox" value="12" />12 | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment