I have edited your code try this one
<style>
#myiput{
position: -webkit-sticky;
position: sticky;
top: 0;
padding: 5px;
}
</style>
<table>
<tr>
<td>
<div>
<input id="myinput" type="text">
<table>
<tr style="display: none;" >
<td>
hidden row 1
</td>
</tr>
<tr style="display: none;" >
<td>
hidden row 2
</td>
</tr>
<tr style="display: none;" >
<td>
hidden row 3
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
I want you to stay fixed
</td>
</tr>
</table>
solved How to make a div fixed