Answer the question
In order to leave comments, you need to log in
jquery each addClass highlight only the first element, why?
I must say right away that I am not strong in jq. Perhaps the answer is something very simple.
I can not understand why only the first element. I checked in the cookies there are several id
Cookies this is a plugin.
$.each Cookies.get('order_item_ids').split(','), (i, id) ->
$(".a_schedule_item[data-rental-item-id='" + id + "']").addClass('selected')
Answer the question
In order to leave comments, you need to log in
Try to debug, for example, output to the console Cookies.get('order_item_ids').split(',')
and inside the function console.log i, id
, it might help.
Logically, everything seems to be correct.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question