Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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