Search code examples
htmltouchw3c-validation

Where are ontouch() events allow to be? Why not on DIV's?


validator.w3.org is is throwing an error:

Attribute ontouchmove not allowed on element div at this point.

On the following code:

<div id="someDiv" ontouchmove="onTouchmove(event)" ontouchend="noTouch(event)"></div>

Doctype is:

<!DOCTYPE HTML>

What elements are touch events allowed on?


Solution

  • Keep it out of the dom

    With jQuery it would look like:

    $('#someDiv').live('ontouchmove',function(e){
        onTouchmove(e);
    });
    
    $('#someDiv').live('ontouchend',function(e){
        noTouch(e);
    });