I'm stuck with .parents()
Hi,
I have a list of input field in my table, i need it to bold the header when user focus on the input field, i've tried many ways but it is not working.
-
<style tyle="text/css">
.f_row { }
.f_row_focus { background-color: #CCC; }
.f_header { }
.f_header_focus { font-weight: bold; }
</style>
<script language="javascript">
// I can highlight the row , but I dont' know how to bold the header
// I have no idea how to select f_header in f_row
$(document).ready(function() {
$("input").focus(function() {
$(this).parents('f_row').addClass('f_row_focus');
}).blur(function() {
$(this).parents('f_row').removeClass('f_row_focus');
});
});
</script>
<table>
<tr class="f_row">
<td class="f_header">Name</td>
<td><input type="text" id="cust_name"></td>
</tr>
<tr class="f_row">
<td class="f_header">Email</td>
<td><input type="text" id="cust_email"></td>
</tr>
</table>
Anyone can help me ? Thanks.