JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html lang="en">
<body>
<div id="container" name="login"></div>
</body>
</html>
JavaScript
var obj = document.getElementById('container');
if (obj.hasAttribute('name')) {
alert('The name attribute exists');
} else {
alert('The name attribute does not exist');
}