I want to change the color of one div by clicking "1" key. I have a bunch of videos playing and when you click "1", a certain video starts playing. I want to create something that looks like a control panel, so that when you click "1" the video will turn on (which I have working with keypress in javascript) but will also change the color of my div when I press "1"
HTML
</head>
<body>
<div class="intro">Press The Number Keys and Q W E To Activate Video
</div>
<div id="one">1</div>
JAVASCIPT JQUERY
$(document).ready(function() {
$(document).keypress(function(event) {
if (event.which === 49) {
$("#one").css('background-color'),("#00ffff");
}
});
});
document.onkeypress = function(e) {
console.log(e)
if (e.key === "1" ) {
var vid = document.getElementById('vid');
vid.paused ? vid.play() : vid.pause();
var vid = document.getElementById('vid').style.opacity = '1';
} else if (e.key === "2" ) {
var cami = document.getElementById('cami');
cami.paused ? cami.play() : cami.pause();
var cami = document.getElementById('cami').style.opacity = '1';
}