The main reason for why hydrogen bonds get formed is the electrostatic attraction that exists between the partial positive hydrogen and the negative lone pairs of electrons.
This means that you have two aspects to take into account when trying to determine whether or not a compound can form hydrogen bonds
- How positive is the hydrogen atom on one molecule;
- How negative is the lone pair of electrons on another molecule.
As you know, hydrogen bonds are formed when hydrogen is bonded to nitrogen, oxygen, and fluorine, three atoms that have very high electronegativities.
The electronegativity of the atom which bonds with hydrogen is important because it determines the magnitude of the partial positive charge - the more electronegative the atom is, the larger the partial positive charge on the hydrogen atom.
If you were to only take this aspect into account, chlorine, which is actually slightly more electronegative than nitrogen, would have no problem in forming hydrogen bonds with hydrogen.
However, chlorine's lone pairs are not "as negative" as nitrogen's because it has a bigger atomic size.
Nitrogen is located in the second period of the periodic table and has a relatively small atomic radius. This means that its lone pair is located in a small orbital, which means that its negative charge is very concentrated.
On the other hand, chlorine is located in the third period of the periodict table, which means that it has a larger atomic radius than nitrogen.
This implies that its lone pairs are located in larger orbitals, so can expect their negative charge to be less concentrated, i.e. spread out over a larger area.
As a result, the electrostatic attraction that forms between the partial positive hydrogen and a lone pair on chlorine will be weaker than what you would get in nitrogen's case.
An interesting case to think about is the chloride ion,
That happens because the full negative charge that sits on the chlorine atom increases the magnitude of the negative charge carried by the lone pairs.
As a result, partial positive hydrogen atoms from water molecules can form hydrogen bonds with the lone pairs of a chloride ion.