V
V
Valeriy19972015-09-09 15:00:12
JavaScript
Valeriy1997, 2015-09-09 15:00:12

Why can't I add an element with an attribute to an array?

I'm tormented by adding elements with a certain attribute to the array, although I seem to be doing everything right. I'm using the autocomlect library, can it interfere? Tell me where is the mistake?

here is the code:

var masiive = []	
masiive.push(($('<li>').attr("data-context-key"));
alert(masiive)


Here is the code demonstrating the problem: jsfiddle.net/t52ka/107

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-09-09
@Valeriy1997

masiive.push(($('<li>').attr("data-context-key"));
the first parenthesis is redundant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question