Cognitive radio is a promising technology for frequency allocation to improve the spectrum utilization efficiency of licensed bands. However, in recent years, the attention of the researchers is focused on security issues that have to be faced by cognitive radio technology. One of the most important issues consists of radio frequency jamming attacks, where adversaries can use on-the-fly reconfigurability and learning capabilities of cognitive radios in order to devise and deploy advanced jamming tactics. Jamming attacks can noticeably affect the performance of wireless communication systems and can lead to significant overhead in terms of data re-transmission and increased power consumption. In this article, a novel compressed sensing-based jammer detection algorithm is proposed using cyclic spectral analysis and artificial neural networks for wideband cognitive radios. A wideband spectrum is considered that is composed of multiple narrowband signals. Narrowband signals can be legitimate or jamming signals. Compressed sensing is used to reduce the overhead of the analog-to-digital conversion and it allows one to estimate a wideband spectrum with sub-Nyquist rate sampling. After the signal has been estimated, the second-order statistics, namely, spectral correlation function, is computed to extract cyclic features of the wideband signal. Finally, a pre-trained artificial neural network is proposed to classify each narrowband signal as a legitimate or jamming signal. Performances of proposed algorithm are shown with Monte-Carlo simulations under different empirical setups.