• 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 in Laravel run JavaScript code stored in php variable?

Laravel Displaying image from database

I'm trying to write a clean url for my website using the $_SERVER['REQUEST_URI'] in php

How to keep value of selected value after form submission?

Fetch files from next cloud storage and display in Laravel website

Check If array is null or not in php

Not able to override collapsible.js in magento 2

Make certain characters of a word from string bold

Webscraping Symfony/Panther: Can't get HTML

PHP password_verify

Xdebug 3 not showing in phpinfo on m1 Monterey

Combine array with same value and add other [duplicate]

Adding custom body class to the custom archive pages

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

SQLSTATE[HY000]: General error: 1 table posts has no column named *

About Contact Privacy policy Terms and conditions