toggleClass and remove class from all other elements
Only You need to Use it. :)
<script>
$(document).ready(function () {
$('.demo_class').click(function () {
$(this).toggleClass('active').siblings().removeClass('active');
});
});
</script>
This will do it
$(".size a").click(function(){
$('.size a.checked').not(this).removeClass('checked');
$(this).toggleClass('checked');
})
Update
Alternatively you could do
$(".size").on('click','a', function(){
$(this).toggleClass('checked').siblings().removeClass('checked');
})