$elements
.sort((a, b) => $(a).text() > $(b).text())
.forEach(el => $('.sorted').append($(el))
const [aCountry, aType, aId] = $(a).text().split('.')
const [bCountry, bType, bId] = $(b).text().split('.')
return Number(aId) - Number(bId) //etc
const getFilterData = {
'show all': function () {
return true
}
}
let array = ['terror', 'army', 'order', 'happiness']
array.forEach(item => {
getFilterData[item] = function(el) {
return el.tags.some(function(element) {
return element.name === 'army'
})
}
})
filterBy(type, el) {
return el.tags.some((element) => element.name === type)
}
<div></div>
div {
position: relative;
width: 200px;
height: 150px;
background: #fff;
border: 1px solid #ccc;
}
div::after {
content: '';
position: absolute;
top: 100%;
left: 20px;
width: 10px;
height: 10px;
border-width: 1px 1px 0 0;
border-style: solid;
border-color: #ccc;
transform-origin: center;
transform: translateY(-50%) rotate(135deg);
background: #fff;
margin-top: 1px;
}