Here is my problem, I'm designing a website that allows you to select a certain item from a list by clicking on it using the onClick attribute. I would like to be able to deselect the item by clicking anywhere else on the page. I tried doing <body onClick="deselect()">
but then if I click anywhere on the page it deselect my item (even when I first click to select it!).
So is there a way to detect if the user clicked somewhere else on the page then on my list?
Thanks a lot.
Edit : I tried onBlur and handleClick with mixed results. The handleClick method get called twice when I click on the item I wish to select, selecting it and deselecting it immediately.