• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

get data-value with variable value

javascriptphp


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"

Related Snippets

Dynamic table in HTML using MySQL and php

SQL to convert multiple rows into a single row of variable length

Android Volley getParams() method not getting called for JsonObjectRequest

GA4 custom event from server side, can someone tell me how i can do the following code in php?

Chunk and transpose a flat array into rows with a specific number of columns

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

How to convert time from one timezone to another in PHP

PHP Form Not Inserting

Ajax GET request fails in laravel 8

Sort multidimensional array by column value within a column

How do I refresh a DIV content?

Download & Save Zoom Recording in directory by PHP

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

Filter WooCommerce products with post__in and additional meta queries

PHP error: "The zip extension and unzip command are both missing, skipping."

About Contact Privacy policy Terms and conditions