• 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

Getting public posts of a random user from Facebook API

How can i hide dt if dd got empty value

Laravel 8 Multiple Relationships for Factory

Laravel MSSQL Server Connection not working

How to Make Laravel Eloquent "IN" Query?

I want to display default profile image if user do not have profile image

PHP - CURL using HTTPS [closed]

How to check user Permissions using Custom Middleware in Laravel

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Laravel post contact form giving me error 419

How do I enable error reporting in Laravel?

Laravel - Browser displays message again when I press back button

500 (Internal Server Error) with Laravel & Docker [duplicate]

phpunit - mockbuilder - set mock object internal property

How do I remove this delivery notification from here?

About Contact Privacy policy Terms and conditions