//sample solution to script.js
//Note: code exists prior to this point
function toggleSelect($piece) {
//if $piece has the class 'selected',
//remove it
if($piece.hasClass('selected')){
$piece.removeClass('selected');
}
//if $piece does not have the class 'selected'
//make sure no other divs with the class 'piece'
//have that class, then set $piece to have the class
else{
$(".piece").removeClass('selected');
$piece.addClass('selected');
}
}
//Note: code exists after to this point
No comments:
Post a Comment