ในการรับค่าของแอตทริบิวต์ rel ของลิงก์ใน JavaScript ให้ใช้ rel คุณสมบัติ. rel ใช้เพื่อกำหนดสถานะของเพจเช่น follow และ nofollow.
ตัวอย่าง
คุณสามารถลองเรียกใช้รหัสต่อไปนี้เพื่อรับค่าของ rel แอตทริบิวต์ของลิงก์
<!DOCTYPE html>
<html>
<body>
<p><a id="anchorid" rel="nofollow" href="https://www.qries.com/">Qries</a></p>
<script>
var myVal = document.getElementById("anchorid").rel;
document.write("Value of rel attribute: "+myVal);
</script>
</body>
</html>