• 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

how to get value from array in laravel

How to access a var with "-" in PHP [duplicate]

Jquery DataTables: Data not displaying in table via Ajax

Return multiple values from a function using mysqli_fetch_assoc [closed]

Laravel Unknown Column 'updated_at'

Cannot connect to own websocket server when on secured domain

Woocommerce Checkout - Add conditional field required if one field is filled

Unable to create lockable file - Laravel 8 & PHP 8

Currently Using CodeIgniter Framework i have an Error

How can I make good efficent AJAX live forms with just jQuery and

Adding hreflang tags automatically in WordPress subdirectory multisite

Get sum of arrays inside array

Laravel Multi-language routes without prefix

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

Combining a describing and one array with data

About Contact Privacy policy Terms and conditions