Appears awesome difference between class and id selector

<!-- Appears awesome difference between class and id selector. -->
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Id in Javascript</title>
</head>
<body>
    <div>
        <p id="a">There is applying formatting.</p>
        <p id="a">There is no effect because we are using id selector.</p>
        <script>
            document.getElementById('a').style.backgroundColor = "red";
        </script>
    </div>
</body>
</html>

Show output :

Id Sel with JS Image
[social_share_button themes='theme1']

Leave a Comment