• 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

Undefined Array Key error when uploading image on php

How To Access A Column In M-M Relationship Table In Laravel

PHP Find Array Index value in multi-line array

Laravel 5.5 change unauthenticated login redirect url

Pass a select with mysqli_fetch_row to a table

mysql_result is defined but mysql_free_result warns it expected a resource

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

Override default Auth routes in Laravel 7

(Laravel) How to delete multiple models including optional relationships?

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

What is the function of the (new Date()).getTime() in PHP?

wordpress function breaks wp-admin

how to use extended ASCII instead of unicode in PHP

Cut an arabic string

How to create a video stream from a single dynamic image in PHP

About Contact Privacy policy Terms and conditions