Reputation: 787
I change this code: Demo1
<li class="nav-item">
<span class="nav-switch" href="#">
<span class="language" id="eg">EG</span>
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
<span class="language" id="ar">AR</span>
</span>
</li>
To this code: Demo2
<li class="nav-item">
<span class="nav-switch" href="#">
<span class="language" id="eg">EG</span>
<a class="switch">
<input type="checkbox">
<span class="slider round"></span>
</a>
<span class="language" id="ar">AR</span>
</span>
</li>
To be able to take action when changing from one language to another using the checkbox but after making that change, the color of the checkbox does not change as in Demo1, I need to take action because I use PHP/Laravel
Upvotes: 1
Views: 218
Reputation: 2382
You removed the label
wrapper from the input which was doing the magic
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
and replace it with a
tag as
<a href="#" class="switch">
<input type="checkbox">
<span class="slider round"></span>
</a>
For this to work you must wrap input
around the label
tag which targets the input inside it
Upvotes: 2