Skip to content

Instantly share code, notes, and snippets.

@andrewmmc
Last active January 8, 2018 09:51
Show Gist options
  • Save andrewmmc/0355d3db4bf051069b604e1b6a20769f to your computer and use it in GitHub Desktop.
Save andrewmmc/0355d3db4bf051069b604e1b6a20769f to your computer and use it in GitHub Desktop.
[Javascript] Check if variable exist in array

Javascript - Check if variable exist in array

$('div#info div#checkboxDiv div.checkboxDivCat a[data-order-status-id]').each(function () {
	var statusId = $(this).data('order-status-id');
	var defaultStatus = [0, 3, 4, 5];
	$(this).removeClass('active');

	if ((defaultStatus.indexOf(statusId) > -1)) {
		$(this).addClass('active');
	}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment