applied conditional jquery to alerts