periksa javascript jika diperlukan

const elem = document.getElementById('input');
if(elem.hasAttribute('required')){
	console.log(true)
}
Undefined