• 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

PHP contact form configuration [duplicate]

Xdebug 3 not showing in phpinfo on m1 Monterey

PHP Slim Framework request using withAttribute error

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

Using PHP to connect to a remote MSSQL database

PHP: Telegram Bot: Insert line break to text message

Lexik JWT authentication problem "Invalid credentials"

mysql_result is defined but mysql_free_result warns it expected a resource

How to validate tin and cst using PHP?

How to KeyBy where multiple items have the same key

PHP: How to quickly split a key=value file into associative array

How to use $this->session->set_userdata in codeigniter

How to render html from a @foreach loop in a textarea

best way to store error messages in Laravel (session or variable)

About Contact Privacy policy Terms and conditions