Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8326099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:39:24+00:00 2026-06-09T00:39:24+00:00

I am trying to setup an array of states and if a state or

  • 0

I am trying to setup an array of states and if a state or value exists in the array do a function. Below is the actual code i am trying to modify and the “stateRedirects” var is what i am trying to us in the if (code === stateRedirects ) { }…

var stateRedirects = [
    'US-TX',
    'US-CA',
    'US-AL'
    // more will be added
]

$('.map').vectorMap({
    map: 'us_en',
    backgroundColor: 'transparent',
    color: '#0071A4',
    hoverColor: false,
    hoverOpacity: 0.5,
    normalizeFunction: 'polynominal',
    scaleColors: ['#C8EEFF', '#0071A4'],
    onLabelShow: function(event, label, code){
        if (code === stateRedirects ) {
            //do nothing
        }
        else if (code) { //if a state is not specified in var stateRedirects then prevent default
            event.preventDefault();
        }                   
    },      
    onRegionOver: function(event, code){
        if (code === stateRedirects ) {
            //do nothing
        }
        else if (code) { //if a state is not specified in var stateRedirects then prevent default
            event.preventDefault();
        }                   
    },
    onRegionClick: function (event, code) {
        window.location = '/' + code;
    }   
});  

Per comments i changed it to use [ and ] but can not figure out how to now make it see if the code matches the array in this line if (code === stateRedirects ) {

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:39:25+00:00Added an answer on June 9, 2026 at 12:39 am

    Define your array of state code properly with square brackets. Then use array.contains functionality, which seems to be what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to setup a C style multidimensional array. It is a 301
I am trying to setup a 2d array in C# to act as a
I'm trying to setup the registration function on my site and I need to
I'm trying to pass the array to the generate function and use its elements
I'm trying to understand the array setup in java. Why must you initialize space
Trying to setup Zend Framework as instructed in this manual $paths = array( realpath(dirname(__FILE__)
I have setup an array full of words as objects. I am trying then
I am trying to pass an array of Student into the function processStudent(string myFilename,
I'm trying to setup IF statements within a function to determine if an outside
Trying to setup a personal image upload/downloader webpage. I've viewed the msdn article on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.