Your HTML should include quotes for the attributes: http://jsfiddle.net/dKWnb/4/
Not required when using an HTML5 document - thanks @bazmegakapa
You create an array every time and add a value to it ... does it work as expected?
Moving an array outside of the live () function works fine:
var myarray = []; // more efficient than new Array() $("#test").live("click",function() { myarray.push($("#drop").val()); alert(myarray); });
http://jsfiddle.net/dKWnb/5/
Also note that in later versions of jQuery v1.7 β the live () method is deprecated and replaced with the on () method.
Manseuk
source share