Forum Moderators: open

Message Too Old, No Replies

how to check if value is in array?

         

carsten888

12:15 pm on Feb 9, 2008 (gmt 0)

10+ Year Member



I read here [javascriptkit.com...] that indexOf(targetElement, [startIndex]) is not suported in IE7.

how do I check if a value is in an array?

(yes I DID google first)

like php:
in_array($value, $array_name)

phranque

12:43 pm on Feb 9, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you can provide your own JavaScript Array.prototype.indexOf [developer.mozilla.org].

carsten888

10:47 am on Feb 13, 2008 (gmt 0)

10+ Year Member



I must conclude ther eis no such function.

thanks for the link, but basically what the script does is loop throught the array to see if value is present, I only need this for a little something so I will just loop the thing on the page.

thanks for reply.

solved.