Onsite earthquake early warning (EEW) systems determine possible destructive S waves solely from initial P waves and issue alarms before heavy shaking begins. Onsite EEW plays a crucial role in filling in the blank of the blind zone near the epicenter, which often suffers the most from disastrous ground shaking. Previous studies suggest that the peak P‐wave displacement amplitude () may serve as a possible indicator of destructive earthquakes. However, the attempt to use a single indicator with fixed thresholds suffers from inevitable errors because the diversity in travel paths and site effects for different stations introduces complex nonlinearities. In addition, the short warning time poses a threat to the validity of EEW. To conquer the aforementioned problems, this study presents a deep learning approach employing long short‐term memory (LSTM) neural networks, which can produce a highly nonlinear neural network and derive an alert probability at every time step. The proposed LSTM neural network is then tested with two major earthquake events and one moderate earthquake event that occurred recently in Taiwan, yielding the results of a missed alarm rate of 0% and a false alarm rate of 2.01%. This study demonstrates promising outcomes in both missed alarms and false alarms reduction. Moreover, the proposed model provides an adequate warning time for emergency response.