delivered the opinion of the court.
By an action commenced in the justice's court of Whitehall ■township, in Jefferson county, the plaintiff by written complaint sought to recover judgment against the defendant for the sum of $119.50 upon an account. The justice of the peace issued a summons in regular form, appointing a special con*444stable to serve it. The constable made return that he had served the summons upon defendant in Jefferson county on June 13. On the return day, June 18, the defendant filed with the justice a written answer, signed by himself and his attorney, in which he denied all the allegations of plaintiff’s complaint, and “for a further and separate defense and counterclaim” alleged, in effect, that the plaintiff was indebted to him in the sum of $96, for which sum he prayed judgment. With his answer he filed an offer in writing wherein he offered to allow judgment to be taken against him for the sum of $34.75 with accrued costs.
Trial was set for June 25. On June 21 defendant filed an amended answer in which he alleged “that this court has no jurisdiction of the said supposed cause of action set forth in the complaint, or of the person of this defendant, for the reason that said alleged cause of action did not arise within the jurisdiction of this court, and for the reason that service was not secured upon this defendant within the jurisdiction of this court, nor as provided by statute.” Three days later, June 24, a stipulation was filed, signed by counsel for plaintiff and defendant, in which it was admitted that service of the summons was made outside of the county of Jefferson and within the county of Madison. When the time for trial arrived the parties announced themselves ready. Plaintiff having produced his proof rested. Defendant declined to introduce any evidence, demanding dismissal of the action on the ground that the court was without, jurisdiction to proceed. The court entered judgment for plaintiff. Defendant then appealed to the district court. After the appeal was perfected defendant filed a motion in the district court asking permission to amend his answer “by adding thereto a further and separate defense and counterclaim, setting up therein certain claims against plaintiff.” The motion was denied. Plaintiff then filed a motion asking judgment on the pleadings in his favor as prayed for in his complaint, while defendant filed a motion asking for judgment of dismissal. The court sustained plaintiff’s motion and judg*445ment followed in Ms favor. From tMs judgment defendant has appealed.
“At any time after the complaint is filed, the defendant may, in writing, or by appearing and pleading, waive the issuing of summons.” (Sec. 9628, Rev. Codes 1921.)
A general appearance in an action is made when a party comes into court without limiting the object for which he comes in. (Kleinschmidt v. Morse, 1 Mont. 100; State ex rel. Mackey v. District Court, 40 Mont. 359, 135 Am. St. Rep. 622, 106 Pac. 1098; State ex rel. Beadle v. Smith, 42 Mont. 492, 113 Pac. 294.)
In the last-cited case it was held that where one defendant not served with summons joined with his codefendant in a motion to dismiss the action he waived service of summons and appeared for all purposes. So in this case when the defendant filed with the justice of the peace an answer to the merits of plaintiff’s cause of action, with which he coupled a counterclaim against the plaintiff, this was an appearance for all purposes, and he was thereafter precluded from challenging either the jurisdiction of the court over his person or over the subject of the action. By doing as he did he invoked the court’s jurisdiction against the plaintiff. Later he offered to suffer judgment against himself for a sum of money and costs. Having done these things his endeavor to question the court’s jurisdiction by his so-called amended answer was utterly futile, and the answer did not present a defense upon any theory. Had defendant demurred upon the ground that the court had no jurisdiction of the person of the defendant, or the subject of the action, the demurrer would have been insufficient because want of jurisdiction does not appear upon the face of the complaint. (Secs. 9641, 9131, Rev. Codes 1921.)
The defendant relies upon Wilcox v. Toston State Bank, 53 Mont. 490, 165 Pac. 292; but in that case at every stage of the proceedings defendants insisted upon their objection to the jurisdiction of the justice of the peace. There the court did not acquire jurisdiction over the persons of the defendants, and *446the action was brought in the wrong county; the defendants protected themselves by appearing specially and challenging the court’s jurisdiction over their persons; and while it.was not necessary for them to appear specially to protect themselves respecting the subject matter of the action, the action having been commenced in the wrong county, nevertheless they did not waive the point by failing to make it (subd. 4, sec. 7047, Rev. Codes 1907; sec. 9680, Rev. Codes 1921), nor by voluntarily submitting to the jurisdiction of the court.
Rehearing denied June 26, 1923.In the instant case it follows that the justice of the peace was right in rendering judgment for the plaintiff.
"When the case came before the district court the defendant again invoked the jurisdiction of the court in his own behalf by asking leave to amend his answer by asserting a counterclaim. The court in the exercise of its discretion denied the request and there is not any complaint made on that score. When the motion for judgment on the pleadings came on for hearing the court had before it only the complaint and the amended answer, and it correctly decided the question in favor of plaintiff.
The judgment is affirmed
Affirmed.
Associate Justices Cooper, Holloway, Galen and Stark concur.