I have to agree that a real fence is much better.
The electric fence is basically a wire buried barely underground. It is hooked up to a household outlet with a transformer to limit the amount of electricity running through the wire. The collar attracts a small jolt of electricity that warns the dog not to go there. Some dogs just take the hit and are gone. If the battery in the collar dies, the dog gets no shock. And only your dog has the collar on. Other animals can come into your yard.
Some dogs just need a low fence to show them the boundaries. Others need something they can't jump or climb.
I'll stick with the real thing.
Bookmarks