anchor jumping by using javascript

You can get the coordinate of the target element and set the scroll position to it. But this is so complicated. Here is a lazier way to do that: This uses replaceState to manipulate the url. If you also want support for IE, then you will have to do it the complicated way: Demo: http://jsfiddle.net/DerekL/rEpPA/Another … Read more

Using setTimeout on promise chain

To keep the promise chain going, you can’t use setTimeout() the way you did because you aren’t returning a promise from the .then() handler – you’re returning it from the setTimeout() callback which does you no good. Instead, you can make a simple little delay function like this: And, then use it like this: Here … Read more

How can I use jQuery to run MySQL queries?

You can use ajax to call a server page (PHP / ASP /ASP.NET/JSP ) and in that server page you can execute a query. http://api.jquery.com/jQuery.ajax/ HTML Javascript This code will be excuted when user clicks on the button with the id “btnVote”. The below script is making use of the “ajax” function written in the … Read more

console.log showing contents of array object

console.log does not produce any message box. I don’t think it is available in any version of IE (nor Firefox) without the addition of firebug or some equivalent. It is however available in Safari and Chrome. Since you mention Chrome I’ll use that for my example. You’ll need to open your window and its developer … Read more