Created
November 28, 2011 15:30
-
-
Save walterdavis/1400781 to your computer and use it in GitHub Desktop.
This file contains 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
var outer = $('theOuterBox'); | |
var comp = $('theComparisonArea').update(); | |
//you shouldn't need to change anything below this | |
var list = outer.childElements(); | |
document.observe('click', function(evt){ | |
var elm; | |
if(elm = evt.findElement('input[type="checkbox"]')){ | |
if((outer.select('input:checked').length + comp.select('input:checked').length) > 2){ | |
evt.stop(); | |
elm.checked = false; | |
}else{ | |
comp.select('div').each(function(em){ | |
outer.insert(em.remove()); | |
}); | |
list.each(function(em){ | |
if(em.down('input:checked')){ | |
comp.insert(em.remove()); | |
} | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment