jQuery addClass example

Change class name on click in jQuery

by Evgen82

HTML

<!doctype html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <p class="p"> АНДРЮХИНЫ ПРОДЕЛКИ </p>
  <style>
    .p {
      font-family: Arial, sans-serif;
      text-align: center;
    }

    .map svg {
      height: auto;
      width: 550px;
      margin: 0 auto;
      display: block;
    }

    .map g {
      fill: #ccc;
      stroke: #333;
      stroke-width: 1;
    }

    .map g:hover {
      fill: #fc0 !important;
      cursor: help;
    }

    .info_panel {
      background-color: rgba(255, 255, 255, .8);
      padding: 5px;
      font-size: 12px;
      font-family: Helvetica, Arial, sans-serif;
      position: absolute;
      border: 1px solid #333;
      color: #333;
      white-space: nowrap;
    }

    .info_panel::first-line {
      font-weight: bold;
    }
  </style>

  <select id="test">
    <option value="population">количество собак в подворотнях</option>
    <option value="mamulation">количество кошек на заборах</option>
    <option value="shmamulation">количество тараканов в головах</option>
  </select>

  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script>
    document.addEventListener('DOMContentLoaded', function () {

      var regions = [
        {
          "region_name": "Таборинский р-н",
          "region_code": "TAB",
          "population": 1,
          "mamulation": 100,
          "shmamulation": 1033
        },
        {
          "region_name": "Гаринский р-н",
          "region_code": "GAR",
          "population": 1,
          "mamulation": 150,
          "shmamulation": 1500
        },
        {
          "region_name": "Белоярский р-н",
          "region_code": "BEL",
          "population": 1,
          "mamulation": 1000,
          "shmamulation": 100
        },
        {
          "region_name": "Богдановичский р-н",
          "region_code": "BGD",
          "population": 1274,
          "mamulation": 274,
          "shmamulation": 774
       ...