Skip to content Skip to sidebar Skip to footer

Conditional Javascript Code Not Executing

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').live('touchstart', f

Solution 1:

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

$('input').live("touchmove touchend", function (e) {

Solution 2:

I think this would work

$('x').live("ontouchmove, ontouchend", function (e) { 
  //do stuff
  if (e.type == 'ontouchmove'){
    //do stuff
  }
  else{
    //do stuff
  }
});

Solution 3:

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.


Solution 4:

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

//Gerner


Post a Comment for "Conditional Javascript Code Not Executing"