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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -