Why isn't this very simple JQuery working?

<>

This question already has an answer here:

Answers


You can't simultaneously set the [src] attribute and include contents for the <script> element.

If you need two scripts, you need to use two separate <script> elements.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
    jQuery(function($) {
        alert("hello");
    });
</script>

As per the HTML5 spec on the <script> element:

If there is no src attribute, depends on the value of the type attribute, but must match script content restrictions. If there is a src attribute, the element must be either empty or contain only script documentation that also matches script content restrictions.


It should be

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

<script type="text/javascript">
    $(document).ready(function() 
    {
           alert("hello");
    });
</script>

Here is a post that explains this clearly-

What if script tag has both "src" and inline script?


Need Your Help

delete all elements from objectlist except one selected element

delphi

What is best coding practise in deleting all elements from a list except one element which I would like to keep inside the list?

how to build shoes and ruby 1.9.3?

c ruby build shoes

I have been trying to build shoes with ruby 1.9.3, and get the following errors at the end of the build: