jQuery - 操作子元素取得父元素屬性(.parent) 2017-01-11
假設html結構<table id='item-123'>
<tr>
<td>
<select name='type'>
<option value='1'>選項1</option>
<option value='2'>選項2</option>
<option value='3'>選項3</option>
</select>
</td>
</tr>
</table>
javascript結構$('table').delegate('select[name="type"]', 'change', function() {
var id = $(this).parents('table').attr('id');
console.log(id);
});