c# - Why isn't this very simple JQuery working? -


this question has answer here:

i trying pass width of page variable c# code behind asp.net, , receiving empty strings. narrowed down problem jquery function not firing. changed simplest code test if function doing anything:

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

and yet, still nothing.

  1. i've included jquery
  2. i've triple checked syntax
  3. no errors reported in console
  4. i looked through other similar 'facepalm' questions, none of solutions work (see above)

what incredibly obvious thing missing?

you can't simultaneously set [src] attribute , include contents <script> element.

if need 2 scripts, need use 2 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 html5 spec on <script> element:

if there no src attribute, depends on value of type attribute, must match script content restrictions.
if there src attribute, element must either empty or contain script documentation matches script content restrictions.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -