• 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

PHPExcel_IOFactory::createWriter causes wrong behaviour

Prevent blank space in pdf pages (DomPdf)

Add 2 Webcam in one page with WebcamJS

Batch request Google Calendar php API

Laravel Displaying image from database

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

PHP: convert all UTF-8 characters to HTML entities

protect my blog content

Why i get wrong output for html markdown?

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

Implode columnar values between two arrays into a flat array of concatenated strings

Change the alert text on add to cart action without selected variation in Woocommerce

Respond with status code 401 on authentication failure using Laravel and Passport?

Get WooCommerce products from specific category

Laravel multi auth - Authentication user provider [] is not defined

About Contact Privacy policy Terms and conditions