• 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 Access A Column In M-M Relationship Table In Laravel

Read users and passwords from a txt file

Change user role if checkout custom checkbox is checked in WooCommerce

TesseractOCR not working for Laravel

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

Updating and Synchronizing Woocommerce Subscriptions to Custom Date

How to set time with DateTime modify?

Laravel Passport - Not able to get token string in response?

Create a zip file and download it

Having trouble with PDO queries (Notice: Undefined index)

Symfony 4: "Autowire: you should configure its value explicitly."

Losing session data after POST from third party website

Results page in other window

ldap is missing from system when installing adldap2 in laravel

How to make a foreign key not using primary key

About Contact Privacy policy Terms and conditions