Changed to jQuery map function

By changing from javascript map function to jQuery map function the demo
now works.