var types = {
"Grocery": "gro",
"Restaurant": "res",
"Bar": "bar",
"Pizza Delivery": "piz",
"Quick Service": "qui",
"Retail": "ret",
"Salon": "sal"
}
$(".type_changer").attr("id", types[$(this).text()]);
I understand that the class type_changer
id is being changed to the part of this array but I don't understand types[$(this).text()]
and this line
$(this).parents('.select-holder').find('.text').text($(this).text());
seems almost understandable but I get confused on the .parents
and the .find('.text').text($(this).text());