• 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 can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

how can I set a session variable in Drupal 8 and get it in a php script?

Get sum of arrays inside array

CodeIgniter 4: Like and Dislike Functionality

Manage independently the decimal number of the price of each product [duplicate]

Laravel set default language not working

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

How to create a cookie to store the timestamp of when a page is first loaded with php

IlluminateDatabaseQueryException could not find driver [duplicate]

Parameter is not sent to Laravel route in Ajax

Statement that checks whether a URL contains a particular path?

Get WooCommerce product variation attribute terms in admin products general box

Make Shipping Method fields Mandatory on Woocommerce checkout page

How to get company posts from LinkedIn via API?

How to add a heading in between checkout fields of WooCommerce

About Contact Privacy policy Terms and conditions