Q: How to link .css and .js files to HTML missing  and  tags Files, such as .js and .css can be linked to HTML documents in a number of ways. This is how I do it:
$('body').append('<link rel="stylesheet" type="text/css" href="{url}">');

or you can also insert stylesheet to the head instead:
$('head').append('<link rel="stylesheet" type="text/css" href="{url}">');

What selector should I use to add the into a document with no header, or body elements:
<div>My page</div>.


Side note:
  I thought about this in the consideration that most modern browsers will render documents without <head></head> nor <body></body> as valid HTML. So some programmers overlook these tags. I'm writing a Java program that parses Rich Text HTML mail. Some HTML web page designers don't put these elements in their documents. I have to consider this. 


A: Documents without start or end tags for the head and body elements are valid HTML. The tags are explicitly optional in the specification (and have been since the first HTML DTD was published).
The elements are still there (they are mandatory, it is just the tags that are not) and can be reliably targeted through the DOM (and this isn't a feature restricted to "modern browsers"). 
If you want to append a div to the body of an HTML document, then just target the body. You don't need the tags to exist.

A: I would just create an element for appended scripts/styles at the very top and append everything there. 
<div id="resources"></div>
<div class="container">
  <!-- Stuff here -->
</div>

and for the js
$('#resources').append('<script src="path/to/script" type="text/javascript"></script>');

I don't see any reason why that wouldn't work... worst case scenario, although sloppy, just do <script> and <style> tags. 
