I’ve got this code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" href="http://code.jquery.com/jquery-1.5.min.js" />
<title>JQuery Demo 1</title>
<style type="text/css">
#box
{
background-color: #ff0000;
}
</style>
<script type="text/javascript">
</script>
</head>
<body>
<div id="box">----Text----!</div>
</body>
</html>
When I include the Jquery file from Google, the div “box” stops being red. When I remove the JQuery file, it becomes red again. WHY?
Try not using self closing syntax for your
scriptelement, e.g.…and the correct attribute to point to a script file is
src, nothref.See it on jsFiddle.