Jason Knight
Mar 4, 2022

--

Sneaky trick you might find entertaining? A LOT of these object and element methods return the object/element you target. Thus, well... get a load of this.

Object.assign(
document.body.appendChild(
document.createElement("button")
), {
name : "delete",
value : '102' // record number
}
).textContent = "delete";

Crazy stuff. And why I prefer appendChild to append.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

No responses yet