I am creating a function but the problem is that neither onmousedown nor onmouseup works for me from the cell phone, which functions should I use to replace these and make it work? since basically it is necessary because it is going to be an app not a web page.
var record = document.getElementById("record");
record.onmousedown = function() {
record.innerHTML = "Grabando...";
record.style.backgroundColor = "red";
}
record.onmouseup = function() {
record.innerHTML = "Grabado";
record.style.backgroundColor = "green";
}
body{
height: 100vh;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
}
#record{
color: #fff;
width: 100px;
height: 100px;
background-color: black;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
<span id="record">Grabar</span>
The functions for cellular analogous to
onmouseup
andonmousedown
areontouchstart
andontouchend