C
C
cyberlain2016-08-29 22:52:30
JavaScript
cyberlain, 2016-08-29 22:52:30

How to solve this array comparison problem?

Given: a multiselect customized by chosen and several divs each with their own data-prop set.
It is necessary: ​​to highlight the divs with the corresponding data-props when the select is on change
The task was partially solved like this https://jsfiddle.net/u04azze1/ - on the first selection, the corresponding divs are highlighted
But on the second - the program does not work correctly, comparing the arrays of selected options and blocks with data props does not work.
Where did I go wrong?

3ad6309d55324b35866df536bc7e756a.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2016-08-30
@cyberlain

Main build: https://jsfiddle.net/u04azze1/1/
Corrected the coloring when the tags field is empty and speeded up the check with break: https://jsfiddle.net/u04azze1/4/
PS: checked: works with jquery 1.12.4 ( which is under IE8)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question