javascript multiple tabs not working properly
<p>I am developing a WordPress site and wanna do something like this:
<a href="https://i.stack.imgur.com/3TINN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3TINN.png" alt="enter image description here"></a></p>

<p>I have a fiddle of how it working now:
<a href="https://jsfiddle.net/Wosley_Alarico/9gcrjntr/" rel="nofollow noreferrer">https://jsfiddle.net/Wosley_Alarico/9gcrjntr/</a></p>

<p>It only works when I click on the links of the first tab.</p>

<p>Is there a better way that you can help me create multiple tabs each with their content using javascript or jquery?</p>

<p>HTML:</p>

<pre><code>&lt;ul class="tab"&gt;
  &lt;li&gt;&lt;a href="#" class="tablinks" onclick="openCity(event, 'London')"&gt;London&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" class="tablinks" onclick="openCity(event, 'Paris')"&gt;Paris&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" class="tablinks" onclick="openCity(event, 'Tokyo')"&gt;Tokyo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div id="London" class="tabcontent"&gt;
  &lt;h3&gt;London&lt;/h3&gt;
  &lt;p&gt;London is the capital city of England.&lt;/p&gt;
&lt;/div&gt;

&lt;div id="Paris" class="tabcontent"&gt;
  &lt;h3&gt;Paris&lt;/h3&gt;
  &lt;p&gt;Paris is the capital of France.&lt;/p&gt;
&lt;/div&gt;

&lt;div id="Tokyo" class="tabcontent"&gt;
  &lt;h3&gt;Paris&lt;/h3&gt;
  &lt;p&gt;Paris is the capital of France.&lt;/p&gt;
&lt;/div&gt;
&lt;ul class="tab"&gt;
  &lt;li&gt;&lt;a href="#" class="tablinks" onclick="openCity(event, 'London')"&gt;London&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" class="tablinks" onclick="openCity(event, 'Paris')"&gt;Paris&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" class="tablinks" onclick="openCity(event, 'Tokyo')"&gt;Tokyo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div id="London" class="tabcontent"&gt;
  &lt;h3&gt;London&lt;/h3&gt;
  &lt;p&gt;London is the capital city of England.&lt;/p&gt;
&lt;/div&gt;

&lt;div id="Paris" class="tabcontent"&gt;
  &lt;h3&gt;Paris&lt;/h3&gt;
  &lt;p&gt;Paris is the capital of France.&lt;/p&gt;
&lt;/div&gt;

&lt;div id="Tokyo" class="tabcontent"&gt;
  &lt;h3&gt;Paris&lt;/h3&gt;
  &lt;p&gt;Paris is the capital of France.&lt;/p&gt;
&lt;/div&gt;
</code></pre>

<p>JAVASCRIPT:</p>

<pre><code>function openCity(evt, cityName) {
    var i, tabcontent, tablinks;
    tabcontent = document.getElementsByClassName("tabcontent");
    for (i = 0; i &lt; tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }
    tablinks = document.getElementsByClassName("tablinks");
    for (i = 0; i &lt; tablinks.length; i++) {
        tablinks[i].className = tablinks[i].className.replace(" active", "");
    }
    document.getElementById(cityName).style.display = "block";
    evt.currentTarget.className += " active";
}
</code></pre>

<p>CSS:</p>

<pre><code>ul.tab {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
}

/* Float the list items side by side */
ul.tab li {float: left;}

/* Style the links inside the list items */
ul.tab li a {
    display: inline-block;
    color: black;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    transition: 0.3s;
    font-size: 17px;
}

/* Change background color of links on hover */
ul.tab li a:hover {
    background-color: #ddd;
}

/* Create an active/current tablink class */
ul.tab li a:focus, .active {
    background-color: #ccc;
}

/* Style the tab content */
.tabcontent {
    display: none;
    padding: 6px 12px;
    -webkit-animation: fadeEffect 1s;
    animation: fadeEffect 1s;
}

@-webkit-keyframes fadeEffect {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes fadeEffect {
    from {opacity: 0;}
    to {opacity: 1;}
}
</code></pre>