• 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

PHP mail sending empty mails

Undefined variable in Laravel 8 project (php 7.4)

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

Google API Heatmap Layer exception, why?

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

Display a product custom field only in WooCommerce Admin single orders

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

Redirect to previous page with php

Error converting docx to pdf using Unoconv

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

CodeIgniter extend CI_URI undefined method

XML to CSV with PHP converter [problem with images grabing]

Add New Parameter to Existing URL using htaccess

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

str_replace or preg_replace random number from string

About Contact Privacy policy Terms and conditions