0

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>

4 Answers 4

1

You must close <script> tag.

W3.ORG:

Start tag: required, End tag: required

Sign up to request clarification or add additional context in comments.

Comments

0
<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

Comments

0

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

Comments

0

Your are closing the script tag too early. Remove the last slash from the first row.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.