I'm trying to add a "disabled" class to an element which has a class name not in array, and I have an array output like this :
["xs", "xl", "s", "m"]
and the html markup like this:
<a href="js:;" class="pa_size xs" title="xs" data-select="pa_size" data-value="xs">XS</a>
<a href="js:;" class="pa_size xl" title="xl" data-select="pa_size" data-value="xl">XL</a>
<a href="js:;" class="pa_size s" title="s" data-select="pa_size" data-value="s">S</a>
<a href="js:;" class="pa_size m" title="m" data-select="pa_size" data-value="m">M</a>
<a href="js:;" class="pa_size l" title="l" data-select="pa_size" data-value="l">L</a>
I have tried something like this:
if ( $.inArray(val, array) !== -1 ) { ... }
or
$.each(array, function() { ... }
but no luck.
if ( $.inArray(val, array) !== -1 ) {...}should work in proper context is why i askval