• 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

Star rating with half star support

WordPress Security Standards want me to escape my html, but how to do it correctly?

how to search for a file with php

PHPUnit (Phar) Fatal Error Only When Test Fails

Dropdown with current value from Mysql

How to give apache permission to write to home directory?

How to put php code inside opening and closing shortcodes

How to debug in WooCommerce 3+

Custom add to cart button URL for specific product in WooCommerce?

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

Adding hreflang tags automatically in WordPress subdirectory multisite

PHPExcel export HTML table to xlsx

OctoberCMS / Anonymous Global Scope

how to use extended ASCII instead of unicode in PHP

Laravel 5 session not persisting after user is logged in

About Contact Privacy policy Terms and conditions