As you can see in Images 2 and 3 the screws stay in the jar lid.
The shape of the big magnets that come from Speakers sit on the table with the jar lid on top perfectly.
They would be excellent I would imagine for big jar lids or big metal containers and bigger nuts and bolts in them.
If the container holding the nuts and bolts gets knocked over then hopefully none will fall out.
In Image 3 I used the small magnets that are used on fridges, and they do a good job for the small screws.
I hope that you find this tip useful.
All the best from
James M Sandbrook.
14th of April, 2021.