10fastfingers jquery hack code

write this code  in the console and run 🙂

[code language=”javascript”]
var e = jQuery.Event(“keyup”);
e.which = 32;
var numofspans = $(“#row1 span”).size();
var n=0;
var timer = setInterval(put , 120);
function put (){
if (n == numofspans){


Explanation :

well, we know that the word entered is submitted by pressing spacebar (in the input box) So we need to create such as pressing spacebar event . “jQuery.Event(“keyup”)” creates an event of keyup , then we have to assign which key we want to be pressed: “e.which = 32;”, 32 is the key code of spacebar.

Then we repeat a function to put the word in the input box : “var timer = setInterval(put , 120); ” setInterval repeats a function every x ms(milliseconds) which is given as the second parameter. In this case, it is 120 ms . (you can give it whatever timespan < (number of words) /6000 .)

and eventually, the put function, it gets the word(which has the class .highlight) and values the input box with that. every time this function executes, it adds up to the counter variable n so when the all the words have been typed, we can stop the iterative function: “clearInterval(timer);”

Leave a Reply

Your email address will not be published. Required fields are marked *