• 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

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

Connecting an HTML webpage to a SQL Server

Laravel Sanctum CSRF not authenticating

PHP drop down list using array's and foreach (else and for) code

Convert PHP array into HTML tag attributes separated by spaces

LARAVEL: How to fetch id dynamically in a query builder?

What is the difference between client-side and server-side programming?

Open a popup box after receiving result from ajax

Transform array, set each array element with parent key php

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Adding multiple items to WooCommerce cart at once

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Woocommerce redirect after add-to-cart error

how to sort by a custom appended relation to model

About Contact Privacy policy Terms and conditions