• 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

Call to undefined function openssl_decrypt

jQuery Ajax Post with data

How to install LDAP in Docker php-fpm alpine

PHP to search within txt file and echo the whole line

Detect emoticons in string

Laravel query builder binding parameters more than once

Prestashop webservice API creating cart rules

Where do I need to place a hook for phpunit?

correct PHP headers for pdf file download

Add and update products to session cart in Laravel

PHP: Insert marker every 3 iterations

php curl_exec() Connection refused when retrieving a remote image

send email using gmail-api and google-api-php-client

Reorder attribute dropdown terms in Woocommerce single variable products

Don't show recurring price for WooCommerce subscriptions worth 0$

About Contact Privacy policy Terms and conditions