javascript - jQuery $.inArray() returns 0 -
if have array ('a', 'b')
, check $.inarray('a', thearray);
index, 0, , false. need check result further , it's annoying...
is there quick method trough can true/false, , not indexes?
basically have string in html5 data attribute: data-options="a,b,c"
, 3 a, b, c variables in javascript must take true/false values based on what's inside data-options...
you can achieve invoking binary not
operator.
if( ~$.inarray('a', thearray) ) { }
explained in detail here: typeofnan.blogspot.com/2011/04/did-you-know-episode-ii.html
Comments
Post a Comment