Reputation: 563
When i use the following syntax, the inline script is not executed. In Firebug not able to debug the code.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript" />
<script>
$(document).ready(function () {
$('#btn').bind('click', function () {
alert('hai');
});
});
</script>
but if i change the external file add script, it works fine. no issues at all.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript" > </script>
Upvotes: 0
Views: 653
Reputation: 16460
You must close <script>
tag.
W3.ORG:
Start tag: required, End tag: required
Upvotes: 1
Reputation: 5019
Your are closing the script tag too early. Remove the last slash from the first row.
Upvotes: 0
Reputation: 3055
the browser inserts the content from the url provided in the src
attribute into the <script></script>
tag. so if there is only a emtpy tag you can't insert anything
Upvotes: 0
Reputation: 50966
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#btn').bind('click', function () {
alert('hai');
});
});
</script>
script is html pair tag. You have to close it
BTW there's no reason to use https
Upvotes: 0