• 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

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

Laravel Unknown Column 'updated_at'

Symfony/Form add attribute based on the data

how to see if database exists with PDO [duplicate]

Converting array to string and then back in PHP

Laravel - Implicit route model binding with soft deleted data

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

The sum of the user's points

PHP DOTENV unable to load env vars

Composer fails with kylekatarnls/update-helper on new homestead

PHP mail function is sending blank message body

How to Display Data in Yajra Datatables Laravel 7?

Add New Parameter to Existing URL using htaccess

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

How to write PHP in XSLT

About Contact Privacy policy Terms and conditions