getting the next 'select' item
Hi, I have a little problem with getting the next 'select' item in a table. I have my html code like so:
- <td><select name='client' id='client' onchange="populateProjects(this)">
<?php foreach($clts as $row) :
echo "<option value=".$row->client_id.">".$row->client_name."</option>";
endforeach; ?>
</select>
</td>
<td><select name='project' id='project'>
</select>
</td>
And the function populateProjects() is like this:
- function populateProjects(sel){
$.post('user/getProjectsByClient',{client_id:$(sel).attr('value')},function(response){
var sel2 = $(sel).next('select');
alert($(sel2).val());
},"json");
}
The alert box gives me the value "undefined" :(
Any ideas?