touchstart event does not use the right element id
Posted: Tue May 07, 2019 1:14 am
When I set the "touchstart" event to a text element, the generated code does not look for the right element, "wb_" prefix is missing in the getElementByID.
<div id="wb_UtcLocalT" style="position:absolute;left:6px;top:4px;width:105px;height:26px;z-index:32;" class="clickable" onclick="flipUtcLocal();return false;">
<span style="color:#000000;font-family:'Comic Sans MS';font-size:19px;">UTC/Local</span></div>
...
var el = document.getElementById('UtcLocalT');
if (el.addEventListener)
{
el.addEventListener('touchstart', ontouchstartUtcLocalT);
}
function ontouchstartUtcLocalT(e)
{
flipUtcLocal();return false;
}
<div id="wb_UtcLocalT" style="position:absolute;left:6px;top:4px;width:105px;height:26px;z-index:32;" class="clickable" onclick="flipUtcLocal();return false;">
<span style="color:#000000;font-family:'Comic Sans MS';font-size:19px;">UTC/Local</span></div>
...
var el = document.getElementById('UtcLocalT');
if (el.addEventListener)
{
el.addEventListener('touchstart', ontouchstartUtcLocalT);
}
function ontouchstartUtcLocalT(e)
{
flipUtcLocal();return false;
}