• 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

Using PHP to connect to a remote MSSQL database

php - add comma thousands separator but remove trailing zeros

How update php.ini on a Mac OS X Mojave?

Php - Sum up the numbers in an array one by one

How can I make Laravel return a custom error for a JSON REST API

how to make my own auto increment in php?

Form Validation and Submission to database

Adding the custom page with add_menu_page function on Wordpress

How to get quarter for future date using Carbon?

Display specific shipping method if woocommerce product has specific acf field value

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

How do I call a php file with axios?

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Having issue with matching rows in the database using PDO

PHPS source file - 403 Forbidden You don't have permission to access this resource

About Contact Privacy policy Terms and conditions