I have a dropdown menu that grabs the href of another dropdown and saves it to a variable. How can I redirect the page using window.location.replace() with out it looping.
let deutsch_link = '';
$('.lang_list_class li a').each(function() {
if ($(this).text() == "Deutsch" || $(this).text() == "Deutsche" || $(this).attr("data-language") == "de") {
deutsch_link = $(this).attr("href");
console.log(deutsch_link);
window.location.replace(deutsch_link);
}
});