Placing blocks on specific blocks only [duplicate]

Solution 1:

I'm not sure what command you've been using, but this definitely works:

/give @s lever{CanPlaceOn:["white_wool"]}