• 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

Laravel print last executed SQL query with Query log

Additional price based on cart item count in WooCommerce

How to add a sidebar to Woocommerce Shop Page?

How to remove from a multidimensional array all duplicate elements including the original?

How do I do HTTP basic authentication using Guzzle?

Match single unknown parameter php (Morse-code Regex)

Inserting data into SQL Server Db An Invalid direction was specified

Laravel php artisan serve to mimic HTTPS

How to install php yaml on CentOs?

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

How to get transaction details in notify_url page in paypal

How to send image,audio or video through the WhatsApp API - PHP

Clients authentication and user authentication with laravel

HTML and PHP in one file

Popup Window and PHP form

About Contact Privacy policy Terms and conditions