I dont know how to explain this, so ill do the best that I can.
I have a page that has some simple javascript on it:
<script language="javascript" type="text/javascript">
function clearIt(txtbox, initVal) {
alert('f');
if (txtbox.value == initVal) {
txtbox.value = '';
}
}
function fillIt(txtbox, initVal) {
if (txtbox.value == '') {
txtbox.value = initVal;
}
}
</script>
The above code works fine, until I add:
<script src="Scripts/jquery-1.4.2.js" type="text/javascript" />
If its ABOVE the previous script block, CSS doesnt load.
If its BELOW the previous script block, my clearIt\fillIt functions dont work. Any idea’s why referring to this script can cause my other stuff to bomb?
Try this instead –
Also, with the jQuery version you are using, you should have all of your CSS referenced first (before javascript).
This is from the jQuery Enlightenment book –
Previously on Stackoverflow – Why don’t self-closing script tags work?
Why don't self-closing script tags work?