Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery get data-*

// Fetching data
var fruitCount = $(this).data('fruit');
OR 
// If you updated the value, you will need to use below code to fetch new value 
// otherwise above gives the old value which is intially set.
// And also above does not work in ***Firefox***, so use below code to fetch value
var fruitCount = $(this).attr('data-fruit');

// Assigning data
$(this).attr('data-fruit','7');
Comment

jquery get data element

$(this).data('cars');
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript bounce animation 
Javascript :: Removing borderline of input in react 
Javascript :: notify jquery 
Javascript :: how to apply reduce to an empty array in javascript 
Javascript :: Multiple line string in JS 
Javascript :: Create buffers from strings using the Buffer.from() function. Like toString(), you can pass an encoding argument to Buffer.from(). 
Javascript :: import and export data in mongodb 
Javascript :: replace in string all occurance jquery 
Javascript :: javascript timeline 
Javascript :: check if array does not contain string js 
Javascript :: write hello world in javaskript 
Javascript :: jest Cross origin http://localhost forbidden 
Javascript :: get element by id two ids 
Javascript :: react setstate concat string 
Javascript :: react native ant design 
Javascript :: obfuscate js string 
Javascript :: javascript add maxlength attribute 
Javascript :: response intersepters for axios create 
Javascript :: get query params from url 
Javascript :: put image in canvas with cover mode 
Javascript :: .keys() array 
Javascript :: array last element 
Javascript :: js export options 
Javascript :: moment get month day 
Javascript :: convert positive to negative number javascript 
Javascript :: react insert variable into string 
Javascript :: Merging Or Copying Arrays Using Spread Operator 
Javascript :: javascript number to string 
Javascript :: javascript array last element 
Javascript :: object loop 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =