JSFiddle - React, Tailwind, and code Playground

by davestein

HTML

<div id="stuff"></div>

JavaScript

console.log({
    a : document.getElementById('stuff').getAttribute('id') ,
    b : document.getElementById('stuff').getAttribute('notreal')
});

console.log({
    a : $('#stuff').attr('id') ,
    b : $('#stuff').attr('notreal')
});

console.log({
    a : $('#stuff').attr('id') ,
    b : undefined
});