We propose a new method of domain-wall trapping on submicron magnetic wires. In our proposal, trapping is accomplished by placing a submicron magnetic bar in the vicinity of the magnetic wire. The stray field from the bar can either aid or hinder the motion of the domain wall, and thus lead to the capture of a domain wall on the wire. Samples are fabricated on silicon wafers by means of electron-beam lithography. Supermalloy is used for both the wire and the magnetic bar. The trapping of a domain wall is confirmed by both magnetic force microscopy and magnetoresistance measurement. The trapping process is understood by means of micromagnetic simulations as well. The width of the magnetic wire influences the trapping-field range of the domain walls. Simulation and experimental results indicate that for the same strength of the localized field, domain walls trapped on narrower wire require larger releasing field for depinning. Trapping domain walls by this method requires no lithographic constrictions on the magnetic wire, which provides a new prospect for the study of current-induced domain-wall motion and other magnetic devices.