Read this passage and open each verse for the full verse feed and commentary tools.
6And Judah took a wife for Er his first-born, and her name was Tamar. 7And Er, Judah`s first-born, was wicked in the sight of Jehovah. And Jehovah slew him. 8And Judah said unto Onan, Go in unto thy brother`s wife, and perform the duty of a husband`s brother unto her, and raise up seed to thy brother. 9And Onan knew that the seed would not be his; and it came to pass, when he went in unto his brother`s wife, that he spilled it on the ground, lest he should give seed to his brother. 10And the thing which he did was evil in the sight of Jehovah: and he slew him also.
Genesis 38:6-10 (ASV)