conditional javascript code not executing

后端 未结 4 416
没有蜡笔的小新
没有蜡笔的小新 2021-01-26 14:47

Does anyone know why this code might not work? touchmove and touchend do not execute only touchstart because that\'s a seperate event and function :)

$(\'input\'         


        
相关标签:
4条回答
  • 2021-01-26 15:14

    What does the console say when you open your site / trying to run the method? :)

    //Gerner

    0 讨论(0)
  • 2021-01-26 15:19

    The event names in the first argument to ".live()" need to be separated by spaces, not commas.

    $('input').live("touchmove touchend", function (e) {
    
    0 讨论(0)
  • 2021-01-26 15:23

    I think this would work

    $('x').live("ontouchmove, ontouchend", function (e) { 
      //do stuff
      if (e.type == 'ontouchmove'){
        //do stuff
      }
      else{
        //do stuff
      }
    });
    
    0 讨论(0)
  • 2021-01-26 15:31

    First off, your event variable should be the parameter e rather than event.

    Second, when testing for equality, you need two equals signs: ==. One equals sign is the assignment operator.

    0 讨论(0)
提交回复
热议问题