Reputation:
My question tells everything. I have already tried the following :-
$(window).scroll(function() {
var height=$(window).scrollTop();
$(div).html(height);
});
You can see it live at http://jsfiddle.net/JdXQA/ . But it is not working. Any help will be appreciated. Thanks in advace.
Upvotes: 0
Views: 33
Reputation: 388436
div
is a string literal, not a variable in this case, so you need to enclose it with in ''
$('div').html(height);
Demo: Fiddle
Upvotes: 1