• 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 Sanctum CSRF not authenticating

How to get array values using foreach in laravel

Refresh specific HTML content that retrieves data from MySQL

How to make Canonicals with PHP

how to insert data into select2 search input after scan using qrcode

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Extract house numbers from address string

Results page in other window

Add a custom text for a particular product on specific email notification in Woocommerce

What is the difference between client-side and server-side programming?

Access denied for user 'homestead'@'localhost' (using password: YES)

Issue saving card for customer

Adding custom body class to the custom archive pages

Yii2: How to download backup files using spanjeta/yii2-backup?

Convert date and time to Jalali in Laravel

About Contact Privacy policy Terms and conditions