Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vanilla javascript remove data attribute

elem.removeAttribute('data-foo');
Comment

Setting, getting, and removing data attributes vanilla javascript

// setting data-foo
var el = document.querySelector('div');
el.setAttribute('data-foo', 'Hello World!');

// getting data-foo
var el = document.querySelector('img');
console.log(el.getAttribute('data-foo'))

// removing data-foo
el.removeAttribute('data-foo');
Comment

PREVIOUS NEXT
Code Example
Javascript :: fetch image from cloudinary in nodejs 
Javascript :: Day of The Year 
Javascript :: how to Initialize and fill an array with the specified values in javascript 
Javascript :: how to return a value to the parent function from ajax javascript 
Javascript :: jq add variable 
Javascript :: multiple comparison javascript 
Javascript :: falsy value in javascript 
Javascript :: javascript centuries 
Javascript :: jquery confirm dialog yes no 
Javascript :: filewatcher nodejs 
Javascript :: how to cookie set in node js 
Javascript :: If Presence Shorthand javascript 
Javascript :: express plus es5 
Javascript :: how to use classnames 
Javascript :: reload stylesheet with out refresh page 
Javascript :: how to call url multiple times 
Javascript :: find invalid json files in directory 
Javascript :: how to route with credentials react 
Javascript :: discord.js permission bitfield 
Javascript :: function directory javascript 
Javascript :: unable to append div multiple times 
Javascript :: ajax status update switch toggle 
Javascript :: pass data from popup js 
Javascript :: crear un texto dinamicamente con javascript 
Javascript :: last iteration is for loop js ES6 
Javascript :: regex match caret 
Javascript :: how to customize reactnative view dropshadow 
Javascript :: architecture express.js 
Javascript :: generic product filter javascript 
Javascript :: stiches js keyframes 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =