A defendant may obtain an injunction upon an answer in the nature of a counterclaim. He shall proceed in the manner prescribed in sections 25-1062 to 25-1080.