Sorry, but the problem is not with the sample code you provided. Or, when it's the only html on your page, you miss the start and end tags.
This clean page works fine on my machine:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head></head> <body> <div><input value='0'></div> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js'></script> <script> setInterval(function() { $('input').val(parseInt($('input').val()) + 1) console.log('div.html(): ', $('div').html()) }, 1000); </script> </body> </html>
Or are you testing in Internet Explorer? In this case, delete the line that is written to the error console:
console.log('div.html(): ', $('div').html())
Jacco
source share