Clear item player holding with mouse
Solution 1:
The reason why /clear
doesn't work in your tests is because you're in Creative Mode. /clear
only affects the grabbed item in GUIs if the user is in Survival or Adventure Mode.
Try switching to Survival mode before attempting /clear
using a command block.
If you need to get it done to players in Creative, you're out of luck. Sorry.