try this : -->
var mylist[0] = new Array(2);
mylist[0][0] = 'value1';
mylist[0][1] = 'value11';
mylist[1] = new Array(2);
mylist[0][0] = 'value1';
mylist[0][1] = 'value11';
mylist[1] = new Array(2);
mylist[1][0] = 'value2';
mylist[1][1] = 'value22';
mylist[2] = new Array(2);
mylist[1][1] = 'value22';
mylist[2] = new Array(2);
mylist[2][0] = 'value3';
mylist[2][1] = 'value33';
mylist[3] = new Array(2);
mylist[2][1] = 'value33';
mylist[3] = new Array(2);
mylist[3][0] = 'value4';
mylist[3][1] = 'value44';
mylist[4] = new Array(2);
mylist[3][1] = 'value44';
mylist[4] = new Array(2);
mylist[4][0] = 'value5';
mylist[4][1] = 'value55';
mylist[4][1] = 'value55';
From: Rahat Bashir <rahat.bashir@gmail.com>
To: phpexperts@yahoogroups.com
Sent: Monday, May 30, 2011 4:23 PM
Subject: [phpXperts] Need help for js array
Hello Experts,
I am a new user of jquery. Can anyone help me solving the following:
I have the following javascript array:
var mylist = new Array();
mylist[0][0] = 'value1';
mylist[0][1] = 'value11';
mylist[1][0] = 'value2';
mylist[1][1] = 'value22';
mylist[2][0] = 'value3';
mylist[2][1] = 'value33';
mylist[3][0] = 'value4';
mylist[3][1] = 'value44';
mylist[4][0] = 'value5';
mylist[4][1] = 'value55';
I want to populate options of a select element with these values with jquery, like below:
<select name="myselect">
<option value="value1">value11</option>
<option value="value2">value22</option>
<option>...........
</select>
I tried $.each(), but could not make it.
Regards,
Rahat Bashir
I am a new user of jquery. Can anyone help me solving the following:
I have the following javascript array:
var mylist = new Array();
mylist[0][0] = 'value1';
mylist[0][1] = 'value11';
mylist[1][0] = 'value2';
mylist[1][1] = 'value22';
mylist[2][0] = 'value3';
mylist[2][1] = 'value33';
mylist[3][0] = 'value4';
mylist[3][1] = 'value44';
mylist[4][0] = 'value5';
mylist[4][1] = 'value55';
I want to populate options of a select element with these values with jquery, like below:
<select name="myselect">
<option value="value1">value11</option>
<option value="value2">value22</option>
<option>...........
</select>
I tried $.each(), but could not make it.
Regards,
Rahat Bashir
__._,_.___
Visit phpXperts website at www.phpxperts.net
.
__,_._,___
No comments:
Post a Comment