• 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

Having trouble with PDO queries (Notice: Undefined index)

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

How to get company posts from LinkedIn via API?

How to submit the custom form data in database in WordPress without plugin using ajax?

How to programmatically find public properties of a class from inside one of it's methods

PHP Fatal error: Class not found - PHPUnit

How to set a domain name with php artisan serve

How to break out of a foreach once a condition is met?

Laravel insert dynamic input values with radio button

Symfony - "framework.test" config is not set to true

CSV to PHP class properties

How to retrieve Active Directory group policy maximum password age using LDAP

Is there an equivalent of DynamoDB on Azure as a PHP session Handler

How do I get friend list from Friends table with counts of friends of my friends

WooCommerce: Add/display Product or Variation custom field everywhere

About Contact Privacy policy Terms and conditions