• 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 to modify CSS in a specific page of the WP admin dashboard (backend)

Unable to uninstall brew php from homebrew

How to KeyBy where multiple items have the same key

How do I enable error reporting in Laravel?

carbon generated datetime not stored correctly into the database

Session timeout in Yii2

How to display table header in every page using FPDF library?

SilverStripe unable to populate multiple member Childs

Open a popup box after receiving result from ajax

"cannot list resources" error from WooCommerce REST API

how to redirect the user back to desired URL after login page in PHP?

How to access a var with "-" in PHP [duplicate]

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

Upload a file Using PHP and JavaScript

PHP - Check if string contains words longer than 4 characters, then include "+ *", and for those shorter than 4 characters include only "*"

About Contact Privacy policy Terms and conditions