An exercise in javascript and jquery