I have a table with two head rows. The first rows displays the header title name, the second header row display some option such as text and select for header filtering like as shown below
<table id="testTable" border="1">
<thead>
<tr>
<th>Account Id</th>
<th>Account Name</th>
<th>Account Type</th>
</tr>
<tr>
<th> <input type="text"> </th>
<th>
<select style="width: 100%;">
<option></option>
</select> </th>
<th>
<select style="width: 100%;">
<option></option>
</select>
</th>
</tr>
</thead>
</table>
script
$(document).ready(function() {
accountName = { "1": "Account1", "2": "Account2" };
accountType = { "1": "AccountType1", "2": "AccountType2" };
$.each(accountName, function(key, value) {
$('select').append($("<option></option>")
.attr("value",key)
.text(value));
});
$.each(accountType, function(key, value) {
$('select').append($("<option></option>")
.attr("value",key)
.text(value));
});
});
By default on the select option will be empty, and I need to add options using jquery, i.e I have having values of Account Name in accountName objectand values of Account Type in accountType object. I need to populate accountName in select box under Account Name header and accountType in select box under Account Type header
Can anyone please tell me some solution for this