
Untitled
By: a guest on
Aug 9th, 2012 | syntax:
None | size: 1.11 KB | hits: 10 | expires: Never
Fastest way to access a class after $(this)
<tr class="invisible">
<td align="center">
<a class="i_edit" data-target="30"></a>
</td>
<td class="category">
<span class="f_type" style="background-image: url(/admin/assets/img/f_type_3.gif);"> Tests </span>
</td>
<td style="background-color: blue;">
<select class="behaviour" name="behaviour" style="opacity: 1;">
<option selected="" value="1" style="opacity: 1;">Por noticias destacadas</option>
<option value="2" style="opacity: 1;">Por fecha</option>
</select>
</td>
</tr>
$('.behaviour').change(function(){
$(this).closest('.i_edit').css('background-color', 'red'); //doesn't work
$(this).parent().closest('.i_edit').css('background-color', 'red'); //doesn't work
$(this).parent().parent().find('.i_edit').css('background-color', 'red'); //this works
return false;
});
$('.behaviour').change(function(){
var obj_this = $(this)
obj_this.parents('tr.invisible').find('.i_edit').css('background-color', 'red');
return false;
});
var obj_this = $(this)