It sounds like you need the inArray function, here is one of the best search results:
Array.prototype.inArray = function (value) {
var i;
for (i=0; i < this.length; i++) {
if (this[i] === value) {
return true;
}
}
return false;
};
Then the following method will look like this:
if (['block','inline-block','table-cell'].inArray(el.currentStyle.display))
Or in a more readable way:
var isBlock = ['block','inline-block','table-cell'].inArray(el.currentStyle.display);
pjesi source
share