Skip to content

Commit

Permalink
Make Live Sample keyboard accessible (#600)
Browse files Browse the repository at this point in the history
Fix mdn/content#25017

---------

Co-authored-by: wbamberg <[email protected]>
  • Loading branch information
dawei-wang and wbamberg authored Sep 15, 2023
1 parent 0da39a7 commit c754e63
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions javascript/introduction-to-js-1/what-is-js/javascript-label.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,32 @@
<meta name="viewport" content="width=device-width" />
<title>JavaScript label example</title>
<style>
p {
button {
font-family: "helvetica neue", helvetica, sans-serif;
letter-spacing: 1px;
text-transform: uppercase;
text-align: center;
border: 2px solid rgb(0 0 200 / 0.6);
background: rgb(0 0 200 / 0.6);
color: rgb(255 255 255 / 1);
border: 2px solid rgb(200 200 0 / 0.6);
background: rgba(0, 217, 217, 0.6);
color: rgb(100 0 0 / 1);
box-shadow: 1px 1px 2px rgb(0 0 200 / 0.4);
border-radius: 10px;
padding: 3px 10px;
display: inline-block;
cursor: pointer;
}
</style>
</head>
<body>
<p>Player 1: Chris</p>
<button type="button">Player 1: Chris</button>

<script>
const para = document.querySelector("p");
const button = document.querySelector("button");

para.addEventListener("click", updateName);
button.addEventListener("click", updateName);

function updateName() {
const name = prompt("Enter a new name");
para.textContent = `Player 1: ${name}`;
button.textContent = `Player 1: ${name}`;
}
</script>
</body>
Expand Down

0 comments on commit c754e63

Please sign in to comment.