• 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

How to submit a form when page loads using JavaScript?

echo language construct is discouraged. (PHP)

php file upload scanning using clamav, permissions on /tmp/

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Laravel multi auth - Authentication user provider [] is not defined

Laravel websockets AWS EC2 - Connection failed

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

api response laravel doesn't show

Sentry + Laravel: how to log an already catched Exception?

PHP - CURL using HTTPS [closed]

Laravel Model save() & update() Not Saving

How to submit a form when page loads using JavaScript?

PHP Include for HTML?

sort() not affecting original array while inside foreach loop

generating a random code in php?

About Contact Privacy policy Terms and conditions