Physics‐informed neural networks (PINNs) have emerged as a promising approach for solving a wide range of numerical problems. Nevertheless, conventional PINNs frequently face challenges in model convergence and stability when optimizing complex loss functions containing complex gradients. In this study, a new mesh‐based PINN method, called M‐PINN, is proposed drawing the ideas of the finite element method (FEM). By partitioning the solution domain into several subdomains and incorporating finite element data distribution constraints to the prior estimates of the predicted data distribution of PINN on the solution domain, the M‐PINN approach effectively reduces the optimization difficulty of conventional PINNs. Moreover, it is sometimes difficult to directly obtain precise boundary conditions in some practical applications. This method can be used to solve PINN problems with unknown boundary conditions, thus having wider applicability. In this study, the efficiency of M‐PINN was demonstrated through a standard 2D linear elastic solid mechanics simulation experiment, and its applicability was investigated in depth. The results indicate that the M‐PINN method outperforms traditional PINN and exhibits superior applicability and convergence, especially in cases involving unknown boundary conditions.