Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Select an Element by its ID Attribute</title> </head> <body> <p id="mark">This is a paragraph of text.</p> <p>This is another paragraph of text.</p> <script> // Selecting element with id mark let match = document.getElementById("mark"); // Highlighting element's background match.style.background = "yellow"; </script> </body> </html>