Genesis 38:10

And the thing which he did displeased the Lord: wherefore he slew him also.

Cross-reference

Genesis 46:12 Historical context

Genesis 46:12 lists Er and Onan as sons of Judah who died — directly references Onan's death from the same event.

Numbers 26:19 Historical context

Numbers 26:19 records that Er and Onan died in Canaan — another genealogical mention of Onan's death.

2 Samuel 11:27 says David's act displeased the Lord — same phrase used here, linking both to divine displeasure with sexual sin.

In 1 Chronicles 21:7, God is displeased with David's census and strikes Israel — the same pattern of divine displeasure leading to direct punishment.