• 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

Put content of wordpress page inside div

Only on Firefox "Loading failed for the <script> with source"

laravel sanctum Route [login] not defined

Add restriction to WooCommerce coupons by allowed user ID

500 Internal Server Error on Ajax request. Not sure the origin of the problem

wordpress : How to specify the cause "This site can’t be reached"

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Clear javascript source cache laravel 5.8

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

Pass an image through AJAX [duplicate]

I want to store data in new index as per my key in php [duplicate]

Insert a DIV after the 6th product only once in WooCommerce category archives

Laravel Displaying image from database

Xdebug 3 not showing in phpinfo on m1 Monterey

Query Optimization, changing the queries in the loop into a single processing query

About Contact Privacy policy Terms and conditions