• 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

Fetch files from next cloud storage and display in Laravel website

Ajax GET request fails in laravel 8

send email using gmail-api and google-api-php-client

how to create html table in php

Get sum of arrays inside array

Laravel 5 issue with wherePivot

Having trouble with PDO queries (Notice: Undefined index)

protect my blog content

SQLSTATE[HY000]: General error: 1 table posts has no column named *

Open a popup box after receiving result from ajax

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

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

Refresh specific HTML content that retrieves data from MySQL

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

Laravel 5 controller sending JSON integer as string

About Contact Privacy policy Terms and conditions