• 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

carbon generated datetime not stored correctly into the database

Zig-zag scan an N x N array

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

how to retrieve the first and last instance of a row in pdo dataset

Exact alternate to mcrypt_encrypt in PHP 7.2

Can't call javascript alert alertify library from PHP

Can't find vendor/autoload.php for Ratchet

Send same name multiple checkbox values via ajax

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

how to use extended ASCII instead of unicode in PHP

Execute only one time and then wait set period of time before executing again

Distribute array row data to make multiple new rows

PHP - installing Xdebug on Mac with XAMPP (Unix File)

PHP-Sort array based on another array?

Filter WooCommerce products with post__in and additional meta queries

About Contact Privacy policy Terms and conditions