I don't know if it was due to Javascript but seems like the browser was the problem in my case. I was testing it on Firefox, switching to Chrome solved the problem and now it works like a charm.