• 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

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

How to make dot match newline characters using regular expressions

How to load Codeigniter 4 lang file into an array variable

Laravel 5.1 Unknown database type enum requested

How to make a foreign key not using primary key

How do I Post to .txt document before form submits

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

Laravel lang slug in url

Trying to iterate over a mongodb cursor twice - failing

Symfony there are no commands defined in the "make" namespace

Multiply each value in array using array_map function

What is the difference between client-side and server-side programming?

Alert message after submitting form in PHP

How to use React Router with Laravel?

Problems getting instance of UploadedFile in Yii2

About Contact Privacy policy Terms and conditions