Select the element → right-click and select lock/unlock. You can also lock the element in the layers panel as shown below ↓