Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Jquery array.push() not working

I have been trying to add variables from a dropdown into an array using Jquery array.push() function but for some odd reason it is not working. Following is the jsFiddle link: http://jsfiddle.net/dKWnb/3/

JavaScript :

$("#test").live("click",function() {
 var myarray = new Array();
 myarray.push($("#drop").val());
 alert(myarray);
});

HTML

<Select name=drop id=drop>
 <option value=1>1</option>
 <option value=2>2</option>
</select>
<input type=button name=test id=test value=test>

Answer*

Draft saved
Draft discarded
Cancel
1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. Commented Dec 30, 2021 at 10:22

lang-js

AltStyle によって変換されたページ (->オリジナル) /