Answers for "remove property from html element javascript"

6

remove attribute javascript

document.getElementsByTagName("H1")[0].removeAttribute("class");
Posted by: Guest on June-19-2020
7

javscript remove a property

var myObject = {
    "name": "jon",
    "gender": "male",
    "registered": "yes"
};
delete myObject.gender;

console.log(myObject);

//other methods
delete myObject.gender;
// or,
delete myObject['gender'];
// or,
var prop = "gender";
delete myObject[prop];
Posted by: Guest on July-06-2020

Code answers related to "remove property from html element javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language