js check attribute code example
Example 1: how to check element has an attribute js
let result = element.hasAttribute(name);
Example 2: js getattribute
const link = document.querySelector('a');
console.log(link.getAttribute('href'));
let result = element.hasAttribute(name);
const link = document.querySelector('a');
console.log(link.getAttribute('href'));