• Hi.
    On my website I run a jquery written reaction-time task

    My problem is that all of the sudden the coding of the users keypresses becomes erroneous, e.g. for user 1-7 all works perfectly, then for user 8-26 completely wrong. This happens literally from one minute to the other. Code was not changed, neither is this caused by users’ os or browser.

    Does anyone have experience with such an issue or are there any problems known about jquery and wordpress compatibility?

    I use the expound theme and do not use plugins.

    Any help or idea would help me.

    Link to the task:here

Viewing 11 replies - 1 through 11 (of 11 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What code specifically is broken?

    Thread Starter ben_aaron

    (@ben_aaron)

    It is this variable that is broken: respcor

    I code the responses and save them to respcor in this part:

    if (code == 97 || code == 108 || code == 65 || code == 76) {
    		if(listen == false) return;
    	  	if (newword.type == "irrelevant" && code == 97 || newword.type == "irrelevant" && code == 65) {
    	  		$("#false").fadeIn(50).delay(200).fadeOut(50);
    			respcor = 0; cor.push(respcor);
    	  	}
    		if (newword.type == "irrelevant" && code == 108 || newword.type == "irrelevant" && code == 76) {
    	  		//$("#false").fadeIn(50).delay(200).fadeOut(50);
    			respcor = 1; cor.push(respcor);
    	  	}
    		if (newword.type == "target" && code == 97 || newword.type == "target" && code == 65) {
    	  		//$("#false").fadeIn(50).delay(200).fadeOut(50);
    			respcor = 1; cor.push(respcor);
    	  	}
    		if (newword.type == "target" && code == 108 || newword.type == "target" && code == 76) {
    	  		$("#false").fadeIn(50).delay(200).fadeOut(50);
    			respcor = 0; cor.push(respcor);
    	  	}
    		if (newword.type == "probe" && code == 97 || newword.type == "probe" && code == 65) {
    	  		$("#false").fadeIn(50).delay(200).fadeOut(50);
    			respcor = 0; cor.push(respcor);
    	  	}
    		if (newword.type == "probe" && code == 108 || newword.type == "probe" && code == 76) {
    	  		//$("#false").fadeIn(50).delay(200).fadeOut(50);
    			respcor = 1; cor.push(respcor);
    	  	}
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I don’t understand, that code is not on the page you linked.

    Thread Starter ben_aaron

    (@ben_aaron)

    If you click on Next the task starts. Sorry I didn’t mention that.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Put alert('dsadsa') within your If statements to see where it’s breaking

    Thread Starter ben_aaron

    (@ben_aaron)

    I did that. It worked without a problem. And exactly that is the problem: It stops coding the responses correctly all of the sudden. If it were for each user or irregularly I would be very confident that it is in the code, but it appears to stop working altogether for all users at a random moment.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    As though $listen is never being set true?

    $("#stimuli").text(newword.stim).fadeIn(10, function () {
        t1 = now();
        listen = true;
    });

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It’s rubbish that this only seems to occur randomly, but I fear that unless you can reproduce the problem then you cannot attempt to debug what’s causing it.

    Thread Starter ben_aaron

    (@ben_aaron)

    Yes. Are there any issues known where some javascript/jquery stopped working correctly after some time?
    So what could have happen that made I go wrong so suddenly?
    I will clean up my code now and several test versions again. I also contacted my webhost (bluehost) about that.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    No there are no known issues with JavaScript, or JavaScript timing out – Talking about JavaScript itself rather than implementations of it.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    There’s nothing relating to WordPress either as your program is running as a stand-alone application in the uploads folder. It is not using WordPress.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Jquery suddenly not working correctly’ is closed to new replies.