JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html lang="en">
<body>
<div id="container" name="login"></div>
</body>
</html>
JavaScript
$(document).ready(function() {
if ($("#container[name]").length) {
alert('The name attribute exists');
} else {
alert('The name attribute does not exist');
}
});