• 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

Creating command to backup MySql database in Laravel

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

Check if user online laravel

image source not readable

Detect emoticons in string

html-php form submission after validation through JavaScript [closed]

Add Class in html Dynamically in PHP

Search for array row with specific column value and return another value from qualifying row

How to change the app environment at run time?

Laravel php artisan serve to mimic HTTPS

Doctrine 2 mapping referencing unique key

Changing font color in javascript

Refresh specific HTML content that retrieves data from MySQL

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

Select option from dropdown menu with PHP and mySql

About Contact Privacy policy Terms and conditions