Genesis 38:3-13

3 She conceived, and bore a son; and he named him `Er.
4 She conceived again, and bore a son; and she named him Onan.
5 She yet again bore a son, and named him Shelach: and he was at Keziv, when she bore him.
6 Yehudah took a wife for `Er, his firstborn, and her name was Tamar.
7 `Er, Yehudah's firstborn, was wicked in the sight of the LORD. The LORD killed him.
8 Yehudah said to Onan, "Go in to your brother's wife, and perform the duty of a husband's brother to her, and raise up seed to your brother."
9 Onan knew that the seed wouldn't be his; and it happened, when he went in to his brother's wife, that he spilled it on the ground, lest he should give seed to his brother.
10 The thing which he did was evil in the sight of the LORD, and he killed him also.
11 Then Yehudah said to Tamar, his daughter-in-law, "Remain a widow in your father's house, until Shelach, my son, is grown up;" for he said, "Lest he also die, like his brothers." Tamar went and lived in her father's house.
12 After many days, Shu`a's daughter, the wife of Yehudah, died. Yehudah was comforted, and went up to his sheep-shearers to Timnah, he and his friend Hirah, the `Adullami.
13 It was told Tamar, saying, "Behold, your father-in-law is going up to Timnah to shear his sheep."