I started to retrain from jQuery to JS and this is more difficult than it seemed.
Here is my standard jQuery code:
function planeChoose() { $('.primary_search .dollar').on('click', function(e) { e.preventDefault(); var tarGet = $('.primary_search .flight_type'); if (!tarGet.hasClass('pop_up_flight')) { tarGet.addClass('pop_up_flight'); } else { tarGet.removeClass('pop_up_flight'); } }); $('.hotel .dollar').on('click', function(e) { e.preventDefault(); var tarGet = $('.hotel .flight_type_hotel'); if (!tarGet.hasClass('pop_up_flight_hotel')) { tarGet.addClass('pop_up_flight_hotel'); } else { tarGet.removeClass('pop_up_flight_hotel'); } }) } Can you rewrite it to JS , please?
So that I could take it as a guide.