The body is part of an HTML document. It contains the content of that document.
Questions tagged [document-body]
250 questions
111
votes
6 answers
Difference between $(document.body) and $('body')
I am a jQuery beginner and while going through some code examples I found:
$(document.body) and $('body')
Is there any difference between these two?
user1617640
32
votes
4 answers
scrollTop() returns 0 in Firefox, but not in Chrome
Not sure if there's another question regarding this, if so I apologize and please don't release the hounds.
Using the html5 doctype and doing a quick console.log off my scroll listener that tells me the value of scrollTop() value. I'm basically…
![](../../users/profiles/1193268.webp)
lxndr
- 692
- 1
- 11
- 25
23
votes
5 answers
Find body tag in an ajax HTML response
I'm making an ajax call to fetch content and append this content like this:
$(function(){
var site = $('input').val();
$.get('file.php', { site:site }, function(data){
mas = $(data).find('a');
mas.map(function(elem, index) {
…
![](../../users/profiles/647909.webp)
Youss
- 3,966
- 12
- 48
- 104
22
votes
3 answers
When do you put Javascript in body, when in head and when use doc.load?
Possible Duplicate:
Where to place Javascript in a HTML file?
Should I write script in the body or the head of the html?
I've always wondered, mainly because when creating pages I always run into trouble, based on the following thing:
When do you…
![](../../users/profiles/1825221.webp)
Sander Schaeffer
- 2,528
- 7
- 25
- 52
15
votes
2 answers
Browser user agent style sheet margin 8px
I was just wonerdering about a white space all around a website. I found out it is there because of the user agent style sheet (Google Chrome) and there is set a margin of 8px to the body tag as default.
How to solve this is not a problem, but I am…
![](../../users/profiles/5291036.webp)
Philipp Sch
- 153
- 1
- 1
- 4
8
votes
4 answers
Scroll listener on body
I would like to ask about scroll listener. I want to add scroll listener on body but it seems doesnt work.
$('body').scroll(function(){
console.log('SCROLL BODY');
});
I create basic example on fiddle, can someone explain me why it doesn't to…
![](../../users/profiles/1297783.webp)
user1297783
- 143
- 1
- 1
- 8
7
votes
2 answers
Random body background-image
I've tried several tutorial on the web and none seems to work properly. What I'm trying to do is quite simple I think:
I have 9 different .jpg images that I need to randomly show up on page load - to be background. This should be fairly simple…
![](../../users/profiles/1144272.webp)
asirgado
- 225
- 3
- 4
- 7
6
votes
3 answers
How can I disable print-screen functionality for a webpage in all browsers?
Using the following we can disable print-screens or screenshots in Internet Explorer:
But these don't work in…
![](../../users/profiles/744531.webp)
ponds
- 1,939
- 4
- 15
- 11
6
votes
3 answers
why do browsers style a predefined margin into all webpages?
Why do all* browsers style an arbitrarily sized margin on the element of all webpages? I'm not surprised by this, as I've been making webpages for years now, but I just assumed it was part of the spec, in the same way text inside …
![](../../users/profiles/453435.webp)
Ben Leggiero
- 25,904
- 38
- 161
- 267
6
votes
2 answers
JS - set window height using current window size
I have some CSS that needs the body to have a height set, but this needs to be done depending on the user.
I have made some code that kind of works - it calculates the window height but it's not changing the body height. What am I doing…
![](../../users/profiles/2003685.webp)
cloggy
- 145
- 3
- 3
- 10
6
votes
3 answers
and Tags 100% Height Fail
I have an application which requires me to use CSS to set the height of the and tags to 100%, like this (JSFiddle version):
html, body {
display: block;
height: 100%;
margin: 0px;
padding: 0px;
width: 100%;
}
body {
…
![](../../users/profiles/663604.webp)
Oliver Spryn
- 15,563
- 30
- 91
- 184
6
votes
5 answers
Will style css tag render in body?
I am using a CMS and apparently it has a bug that will not allow me to add any content to the of a blog post. It inserts everything into the body which in most cases that works okay but in an instance of code like this: