I have an Add More Attachments function. Every time I click the button, one more attachment shows up, which causes the page getting longer. I write a syntax to detect the body's height after the attachments show up, but somehow it doesn't work. Please help.
HTML
<input type="file" /></div><button id="addNew">Add</button>
<div class="attachField"></div>
JS
var i=0;
$('#addNew').click(
function()
{
if( i < 10)
{
i++;
$('.attachField').append( '<div class="attachFile"><input type="file" /></div>' );
}
$('body').on('load', function()
{
var bodyAfterClick = $(this).contents().height();
alert(bodyAfterClick);
$('body').height(bodyAfterClick);
});
}); //end click