• 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

possible options to create pdf file using html elements to generate invoice in php and codeigniter

Lexik JWT authentication problem "Invalid credentials"

How to make Canonicals with PHP

merging two arrays with specified index

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

Why does using salted hash on python and php give me different results?

Form Validation and Submission to database

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

how to make my own auto increment in php?

could not find driver Debian SQL Server PHP

Execute only one time and then wait set period of time before executing again

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

How do I truncate a decimal in PHP?

How to create custom authentication in laravel 8?

Issue with laravel eloquent model property

About Contact Privacy policy Terms and conditions