I find out the solution to my problem. ASP.NET add these two input elements within div. This is why it my previous code was picking these extra 2 divs. What I did to solve the issue was wrap my html code within a main div and call $('#main div').each.
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZAWMcFIVrd603vMUvq/dpg+m8qr3" />
</div>
<div>
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="EF932D07" />
</div>