• 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

Whats the point of running Laravel with the command 'php artisan serve'?

Results page in other window

Apply filter array/return terms

Invalid value in field "itemtype" in Google Search Console

PHP, how to convert Int value to Week days

How to get multiple values with same key from an array PHP

Is there an equivalent of DynamoDB on Azure as a PHP session Handler

Mobile browsers are adding .html to filename on download

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

Converting alphabet letter to alphabet position in PHP [duplicate]

PHP drop down list using array's and foreach (else and for) code

Combining a describing and one array with data

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

Getting output of MS stored procedure on php call

How to show selected value using javascript in laravel

About Contact Privacy policy Terms and conditions