• 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

WAMP Virtual Host not working

How to make a foreign key not using primary key

Woocommerce product attributes with hierarchy like categories

Saving Data from form to database using AngularJS and php

Remove product downloads section in woocommerce email notifications

how can I set a session variable in Drupal 8 and get it in a php script?

Dropdown with current value from Mysql

SQL AVG() to 2 decimals

Valet, Xdebug after reboot Big Sur not working

Android Volley getParams() method not getting called for JsonObjectRequest

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Adding Multiple Custom Post Types in Wordpress

protect my blog content

Add rows to Single product Additional information table in WooCommerce 3.6

Component install error: JInstaller: :Install: File does not exist

About Contact Privacy policy Terms and conditions