• 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

Sort multidimensional array by column value within a column

Zig-zag scan an N x N array

How can I get a div content in php

How to extract price from given url using Xpath?

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

Upload a file Using PHP and JavaScript

Laravel insert dynamic input values with radio button

How to install php yaml on CentOs?

Multiply each value in array using array_map function

PHP error: "The zip extension and unzip command are both missing, skipping."

(Laravel) How to delete multiple models including optional relationships?

Parameter is not sent to Laravel route in Ajax

How to convert a carbon into string, to take the date only?

how to validate form data in codeigniter 4

Laravel - How to properly generate unique slugs from article titles?

About Contact Privacy policy Terms and conditions