How to get toddler to stop pulling hair

My daughter is 18 months old and recently she has started pulling hair. I firmly tell her no and pull her hand away but she still does it. Any tips? Thanks!!