A mixed quantum-classical method aimed at the study of nonadiabatic dynamics in the presence of external electromagnetic fields is developed within the framework of time-dependent density functional theory. To this end, we use a trajectory-based description of the quantum nature of the nuclear degrees of freedom according to Tully's fewest switches trajectories surface hopping, where both the nonadiabatic coupling elements between the different potential energy surfaces, and the coupling with the external field are given as functionals of the ground-state electron density or, equivalently, of the corresponding Kohn-Sham orbitals. The method is applied to the study of the photodissociation dynamics of some simple molecules in gas phase.