• 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

Using array_intersect on a multi-dimensional array

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

How in Laravel run JavaScript code stored in php variable?

Shopify password update using Shopify API

PHP: Insert marker every 3 iterations

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

how to validate form data in codeigniter 4

merge all files in directory to one text file

php 7 php.ini upload_max_filesize not working

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Display a success custom notice after Placing an Order in WooCommerce

How avoid Moved Permanently The document has moved here

How to map the two arrays with a duplicate value?

Twig - How to check if variable is a number / integer

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

About Contact Privacy policy Terms and conditions