Why the variable is not accepting new data (jQuery)?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
13 views
There is a code that when you select the animation type, change data-animation-out of the element of the dropdown-container, everything works here, the problems in the other.

If you change the type of animation to go to the DOM, we will see that the contents of the data-animation-out really changed. But when mouse over on dropdown-container we see a log with the old animation.

It turns out that variable
var dropdown_container = $(this).find('>.dropdown-container');
after receiving the contents once, then refuses to get new content (be updated).

Question: what is the problem and how to get this variable to update its contents?

Code on codepen.io
by | 13 views

2 Answers

0 like 0 dislike
Replace
change_element.attr('data-animation-in', $(this).val());
on
change_element.data('animation-in', $(this).val());

Or Vice versa - all use attr. The data attached to the element using the data method, they are not stored in attributes, so act uniformly is either data or attr.
by
0 like 0 dislike
Why do you need to climb on the attributes? If I understand correctly the guidance should be animation? Use the animate library.css.

If you need the attributes to change, here's a function jq:
element.attr(attributeName, value);
by

Related questions

0 like 0 dislike
1 answer
asked Apr 12, 2019 by konstantinborodov
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users