• 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

Symfony/Form add attribute based on the data

PHP to search within txt file and echo the whole line

Laravel insert dynamic input values with radio button

How to render html from a @foreach loop in a textarea

how to pass row id in href of a tag in codeigniter controller?

PHP usort() order in case of equality

How to use PHPCBF to fix one issue at a time?

Filter array by skipping every nth element from the end

Laravel Command Schedule Not Working Properly

correct PHP headers for pdf file download

Alert message after submitting form in PHP

Laravel lang slug in url

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Laravel: Create morphs() relationship nullable

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

About Contact Privacy policy Terms and conditions