What is the correct syntax for using the defer attribute in your javascript?
I have seen it done two ways:
1:
defer is a boolean attribute [HTML 4.01 spec]:
Some attributes play the role of boolean variables (e.g., the
selectedattribute for theOPTIONelement). Their appearance in the start tag of an element implies that the value of the attribute is "true". Their absence implies a value of "false".[...]
In HTML, boolean attributes may appear in minimized form -- the attribute's value appears alone in the element's start tag. Thus,
selectedmay be set by writing:instead of:
Authors should be aware that many user agents only recognize the minimized form of boolean attributes and not the full form.
However, if you use XHTML, you have to use the second form since XHTML follows XML syntax where attributes always have to have a value.