I'm trying to fix the following code:
const $configuratorMenus = $('.configurators-menu ul li');
$configuratorMenus.click(() => {
let panelID = $(this).data("id");
let panelID2 = $(this).attr("data-id");
console.log(panelID, panelID2);
//$(`#${panelID}`).slideToggle();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="configurators-menu">
<ul>
<li data-id="shapes">
<a href="#">
Shape
</a>
</li>
</ul>
</div>
It keeps consoling undefined
, what am I doing wrong? I couldn't relate any other solution.
Note: I would like to solve this by using the arrow function.