JSFiddle - React, Tailwind, and code Playground
by gutek
HTML
<form id="commentForm" action="/comment/new">
<p>
<input type="text" id="id" />
</p>
<p>
<input type="text" name="action" />
</p>
</form>
JavaScript
var form = document.getElementById('commentForm');
console.log('access by properties');
console.log(form.id); // 1
console.log(form.action); // 2
// break line
console.log('');
console.log('access by attribute');
console.log(form.getAttribute('id')); // 3
console.log(form.getAttribute('action')); // 4