views:

167

answers:

0

this is my code :

<div id="a" ontouchstart="touchstart(event);" style="width:100px ; height:100px;background:red;"></div>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script>
    function touchstart(event){
            $('#a').css('width','1000px')
        }
</script>

what's wrong with my code.

thanks

updated:*

when i add this code, it can be triggered:

$('#a')[0].addEventListener("touchstart", touchstart, false);

so ,why ontouchstart="touchstart(event);" not be triggered