This is what I currently have:
var typeOrder = ['Land', 'Planeswalker', 'Creature', 'Instant', 'Sorcery', 'Enchantment', 'Artifact', 'Vanguard', 'Plane', 'Scheme', 'Summon', 'Tribal', 'Conspiracy', 'Phenomenon'];
$.each(typeOrder, function (_, order) {
var cardQuantity = 0;
var $sorted = $('<div>');
// sort by types
var $types = $('.card-line .types').filter(function () {
return $(this).text() === '["'+order+'"]';
});
// title
if($types.length !== 0) {
cardQuantity += parseInt($types.siblings('.quantity').text(), 10); // quantity
$sorted.prepend('<div class="title-gap"></div><h1>' + order + ' ('+ cardQuantity + ')</h1>');
}
$('#mainboard').append($sorted);
});
parseInt doesn't seem to work here:
cardQuantity += parseInt($types.siblings('.quantity').text(), 10); // quantity
It keeps giving me the integers like a string. For example is the values are 1 + 2 it gives me 12 instead of 3. Not sure why it's not working.
EDIT: FIDDLE