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 :: minecraft infinite snapshot dimensions 
Javascript :: sum of all numbers in an array javascript 
Javascript :: how to can i get custom data attribute value in javascript 
Javascript :: how to get the current date and time in javascript 
Javascript :: get the middle character js 
Javascript :: es6 foreach 
Javascript :: .sequelizerc File Setup 
Javascript :: react js input autocomplete off 
Javascript :: indexof case insensitive javascript 
Javascript :: sequelize custom primary key 
Javascript :: console.log color terminal 
Javascript :: how to replace non alpha numeric characters in javascript 
Javascript :: align text in javascript 
Javascript :: create new angular component command 
Javascript :: socket io leave all rooms 
Javascript :: javascript separate words by capital letter 
Javascript :: onresize js 
Javascript :: flutter jsonDecode UTF8 
Javascript :: javascript copy an object without reference 
Javascript :: how to exclude a specefic tagname from a javascript query search 
Javascript :: vscode default indent type 
Javascript :: character to ascii in js 
Javascript :: map function react not appearing 
Javascript :: protractor element.all for eahc 
Javascript :: check jquery version on console 
Javascript :: js select on change value 
Javascript :: vue read url 
Javascript :: js exec vs match 
Javascript :: match date regex 
Javascript :: Uncaught ReferenceError: axios is not defined 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =