renamed function and set the correct trigger in demo.html