开发者

unable to get jquery to work

开发者 https://www.devze.com 2023-03-05 17:24 出处:网络
I\'m constantly failing to do something useful with jquery. I\'m using the Drupal CMS which integrates jquery by default. I can see the Drupal code calling jquery which works fine. I can also click开发

I'm constantly failing to do something useful with jquery. I'm using the Drupal CMS which integrates jquery by default. I can see the Drupal code calling jquery which works fine. I can also click开发者_如何学C on

<script src="http://samson:90/misc/jquery.js?v=1.4.4" type="text/javascript">

in Firebug, which shows the jquery code. I take this as a "jquery gets loaded and executed".

My code is linked with this code

   <script type="text/javascript" src="http://samson:90/sites/all/modules/vimgalign/vimgalign.js?ll6x5c"></script>

and looks like this

$(document).ready(function() {
    var hallo = $("img");
})

I'm also shure that my code is loaded after jquery.js is loaded.

I do get the following error message: "$ is not a function". If I replace $ with jQuery I don't get an error message. But a breakpoint at

var hallo = $("img");

get's never hit.

Using the code rom sv_in works. But why can't I just call jQuery the standard way?

You can reach the page at http://samson.pluess-production.ch/node/19.

Any idea what I'm missing?


Try this:

(function($){
  var hallo = $('img');
  // Put the jquery code here. You can use $.
})(jQuery)

If this doesn't work then we would need to see your page.


Use tab "Net" in firebug, there you will see what really loaded and what did not. For me, http://samson:90 is not accessible.

0

精彩评论

暂无评论...
验证码 换一张
取 消