• 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

Unable to uninstall brew php from homebrew

Laravel 5 issue with wherePivot

SQL to convert multiple rows into a single row of variable length

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

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Laravel 5.5 change unauthenticated login redirect url

How to insert Google Adsense Code in PHP script?

Parsing JSON File to array in PHP

Sliders in Laravel

Get sum of arrays inside array

Remove categories with all childs derived from parent category

Target Laravelista is not instantiable

Why is this PHP array not the same?

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

Xdebug 3 not showing in phpinfo on m1 Monterey

About Contact Privacy policy Terms and conditions