I think most of us had a Jack in the Box when we were children. Playing with it felt both fun and a little dangerous as we didn't know for sure when suddenly the door would open. A clown (it was usually a clown) would spring out and we would laugh in excitement. And by the way, if I had had the Jack in the Box depicted at the top of the page I probably would still be having nightmares.
The box typically had a music box of some kind inside which played "Pop Goes The Weasel" as you cranked. The song, "Pop Goes The Weasel", was a big dance hall hit in 19th century England. Originally, there were no words to the song other than "pop goes the weasel" but lyrics were later added. Here is the second verse which we rarely hear:
Every night when I go out,
The monkey's on the table,
Take a stick and knock it off,
Pop! goes the weasel.
That, by the way, was from the British version. Here is a verse from the American version:
All around the cobbler’s house,
The monkey chased the people.
And after them in double haste,
Pop! goes the weasel
I had always thought that it was a 19th century invention but it actually has its origins in the 16th century. Here are some images depicting Jack in the Boxes:
Harpers Weekly, Thomas Nast, 1870's
Christmas Greetings, appears to be from the 1930's
Illustration, circa 1860's