This is because you cannot insert a <div> inside a table.
You can try another way to reach your requirement,
Remove all <div> tags inside your table.
Add classes to each of your <tr> that were inside your <div id="#second_area">
So your final code should look like this:
<form id="search_form" name="search_form" method="get" action=""> <table width="98%" id="performance_tbl" align="center"> <tr class="first_tr"> <th scope="row"><label for="employee_id">Employee ID: </label></th> <td><input type="text" name="employee_id" id="employee_id" /></td> </tr> <tr> <td> </td> </tr> <tr class="second_area"> <th scope="row"><label for="company_id">Company Name:</label></th> <td><input type="text" name="company_id" id="company_id" /></td> <th><label for="department_id">Department Name: </label></th> <td><input type="text" name="department_id" id="department_id" /></td> </tr> <tr class="second_area"> <th scope="row"><label for="current_year">Select Year: </label></th> <td><input type="number" name="current_year" id="current_year" /></td> <th><label for="compare_year">Compare Year: </label></th> <td><input type="number" name="compare_year" id="compare_year" /></td> </tr> <tr class="second_area"> <th scope="row"><label for="month_from">Month From: </label></th> <td><input type="number" name="month_from" id="month_from" /></td> <th><label for="month_to">Month To: </label></th> <td><input type="number" name="month_to" id="month_to" /></td> </tr> <tr class="second_area"> <th scope="row"><label for="srch_gender">Select Gender: </label></th> <td> <table> <tr> <td><input type="radio" name="gender" id="female" value="0">FeMale</td> <td><input type="radio" name="gender" id="male" value="1">Male</td> </tr> </table> </td> </tr> <tr> <td> </td> <td colspan="2"><input type="submit" name="search_kpi" id="search_kpi" value="Search Now"></td> </tr> </table> </form>
And your javascript should be modified as follows:
$(document).ready(function () { $('#employee_id').focus(function () { $('.second_area').hide(); }); });
source share