To date, a number of parameter identification methods have been developed for the purpose of structural health monitoring and vibration control. Among them, the extended Kalman filter (EKF) series methods are attractive in view of the efficient unbiased estimation in recursive manner. However, most of these methods are performed on the premise that the parameters are time-invariant and/or the loadings are known. To circumvent the aforementioned limitations, an online EKF with unknown input (OEKF-UI) approach is proposed in this paper for the identification of time-varying parameters and the unknown excitation. A revised observation equation is obtained with the aid of projection matrix. To capture the changes of structural parameters in real-time, an online tracking matrix (OTM) associated with the time-varying parameters is introduced and determined via an optimization procedure. Then, based on the principle of EKF, the recursive solution of structural states including the time-variant parameters can be analytically derived. Finally, using the estimated structural states, the unknown inputs are identified by means of least-squares estimation (LSE) at the same time-step. The effectiveness of the proposed approach is validated via linear and nonlinear numerical examples with the consideration of parameters being varied abruptly.