2014-05-05 18 views
6

iCheck eklentisini kullanmaya çalışıyorum ve JQuery ve javaScript için yeni yapıyorum. Ben etrafına baktı ve bu link bulundu

TypeError: $ is undefined

diyor tarayıcıda bir hata alıyorum, ama anlaşılacağı gibi (jQuery) ekleyerek denedim ama hata mesajı değişmedi.

Gördüğüm web sayfasındaki belirti, web sayfasının, polaris cilt gösterileri için example gibi onay kutusunun içinde ya da siyah olarak durmadığıdır.

Herhangi bir fikrin var mı? TypeError öğesinin işaret ettiği tam satırı öğrenmek için aşağıdaki "c stili yorum - //" konusuna bakın.

<html> 
    <head> 
     <title>jQuery Michele Project</title> 
     <link href="css/skins/polaris/polaris.css" rel="stylesheet"> 
     <link href="css/skins/all.css" rel="stylesheet"> 
     <link href="css/demo/css/custom.css" rel="stylesheet"> 
     <meta charset="UTF-8"> 
     <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
     <script src="js/icheck.js"></script> 
     <script type="text/javascript" src="js/jquery-1.11.0.js"></script> 
     <script type="text/javascript" src="js/jquery.ui.core.js"></script> 
     <script type="text/javascript" src="js/jquery.ui.widget.js"></script> 
     <script type="text/javascript" src="js/jquery.ui.accordion.js"></script> 
     <script type="text/javascript"> 
     $(document).ready(function(){ 
       $("#infolist").accordion({ 
        autoHeight: false 
       }); 
     }); 

     </script> 
     <script type="text/javascript"> 
      $(document).ready(function(){ 
       $('.input').iCheck({ 

        checkboxClass:'icheckbox_polaris', //this is the line that the error message points to 
        radioClass:'iradio_polaris', 
        increaseArea:'-10%' 
       }); 
      })(jQuery); 
     </script> 
     <style type="text/css"> 
      ul {list-style-type: none} 
      img {padding-right: 20px; float:left} 

      #infolist {width:500px} 
     </style> 
    </head> 
    <body> 
+3

jQuery tanımlanır önce ' yüklüyorsunuz. Önce jQuery yükleyin. – Dom

+0

olası yinelemesi [$, jquery'de tanımlanmamış bir hatadır] (http://stackoverflow.com/questions/9313612/is-undefined-error-in-jquery) – JJJ

cevap

10

jQuery tanımlanır önce <script src="js/icheck.js"></script> yüklüyorsunuz: Burada

benim kodundan bir alıntıdır. Önce jQuery yükleyin.

<script type="text/javascript" src="js/jquery-1.11.0.js"></script> 
<script type="text/javascript" src="js/jquery.ui.core.js"></script> 
<script type="text/javascript" src="js/jquery.ui.widget.js"></script> 
<script type="text/javascript" src="js/jquery.ui.accordion.js"></script> 
<script src="js/icheck.js"></script> 
İlgili konular