最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught Reference Error: $ is not defined (anonymous function) $(function() does not work - Stack Overflow

programmeradmin0浏览0评论
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
".dtd">
<html xmlns="" xml:lang="en" lang="en">
  <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta content="utf-8" http-equiv="encoding">
    <link rel="stylesheet" href=".10.3/themes/smoothness/jquery-ui.css" />
    <script language="Javascript" type="text/javascript" src=".9.1.js"></script>
    <script language="Javascript" type="text/javascript" src=".10.3/jquery-ui.js"></script>

    <style type="text/css">
        .ui-datepicker { font-size: 62.5%; }
    </style>

    <script>
    $(function() {
        $("#StartDate").datepicker({ dateFormat: "yy-mm-dd" }).val();
        $("#EndDate").datepicker({ dateFormat: "yy-mm-dd" }).val();
    });
    </script>
 </head>
  <body bgcolor='#6a7c99'>
<input id='StartDate' type='text' style='position:absolute;top:35px;left:92px;width:55px;font-family:arial narrow;font-size:8pt;display:none;' name='StartDate'>
  <input id='EndDate' type='text' style='position:absolute;top:75px;left:92px;width:55px;font-family:arial narrow;font-size:8pt;display:none;' name='EndDate'>
  </body>
</html>

This code does not work. $function() does not work and throws an error. Whats wrong? What other jQuery libraries should be included?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta content="utf-8" http-equiv="encoding">
    <link rel="stylesheet" href="https://code.jquery./ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script language="Javascript" type="text/javascript" src="https://code.jquery./jquery-1.9.1.js"></script>
    <script language="Javascript" type="text/javascript" src="https://code.jquery./ui/1.10.3/jquery-ui.js"></script>

    <style type="text/css">
        .ui-datepicker { font-size: 62.5%; }
    </style>

    <script>
    $(function() {
        $("#StartDate").datepicker({ dateFormat: "yy-mm-dd" }).val();
        $("#EndDate").datepicker({ dateFormat: "yy-mm-dd" }).val();
    });
    </script>
 </head>
  <body bgcolor='#6a7c99'>
<input id='StartDate' type='text' style='position:absolute;top:35px;left:92px;width:55px;font-family:arial narrow;font-size:8pt;display:none;' name='StartDate'>
  <input id='EndDate' type='text' style='position:absolute;top:75px;left:92px;width:55px;font-family:arial narrow;font-size:8pt;display:none;' name='EndDate'>
  </body>
</html>

This code does not work. $function() does not work and throws an error. Whats wrong? What other jQuery libraries should be included?

Share Improve this question edited Sep 23, 2014 at 1:59 karthikr 99.7k26 gold badges207 silver badges191 bronze badges asked Jun 17, 2013 at 22:43 user2495173user2495173 3092 gold badges6 silver badges17 bronze badges 2
  • 2 jQuery was not properly loaded – Sushanth -- Commented Jun 17, 2013 at 22:44
  • 1 Change https:// to // and it should work fine. Your protocols are probably mismatched. – Blender Commented Jun 17, 2013 at 22:44
Add a ment  | 

1 Answer 1

Reset to default 5

Looks like the links for jquery and jquery ui are throwing a 504. Hence the error. https:// does not work.

Try this:

<link rel="stylesheet" href="http://code.jquery./ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script language="Javascript" type="text/javascript" src="http://code.jquery./jquery-1.9.1.js"></script>
<script language="Javascript" type="text/javascript" src="http://code.jquery./ui/1.10.3/jquery-ui.js"></script>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论