get data-value with variable value
PHP Snippet 1:
<a id="element_with_k" class="dropdown-item" data-value="<?= $k ?>"></a>
PHP Snippet 2:
const elementWithK = document.getElementById('element_with_k');
elementWithK.dataset.value // "the content of $k"