开发者

Jquery, i have a div it is clickable except when i put it in wordpress

I can't get my jquery to work in wordpress even when if it is on a normal .htm page it works fine.

i'm trying to click something and fire of an alert

  $(document).ready(function() {
     $("#blue").click(function() {
       alert("Hello world!");
     });
   });

this normally works in an .htm file, but when i stick it in the header file of my wordpress page, nothing happens when i click on the div.

<div id="blue" style="display:table-cell;width:50px;height:50px;background-color:blue;"></div>
开发者_开发百科

By the way the div looks like this on my wordpress page

<div id="menu" style="position:absolute;top:0px;height:50px;width:100%;background-color:black;text-align:center;">
<div id="menuTable" style="width:800px;margin-left:auto;margin-right:auto;display:block;">
<div id="a1" class="start" >Andie</div>
<div id="a2" class="start" >Work</div>
<div id="a3" class="start" >Play</div>
<div id="a4" class="start" >Dream</div>
</div> 
</div>


I don't see the div with id=blue on your wordpress page.

I see a div with id=menu that looks the similar. Make sure your JavaScript references the new ID.

  $(document).ready(function() {
     $("#menu").click(function() {
       alert("Hello world!");
     });
   });


fixed.. i had to add the jquery google file from google? y'know the one that makes the jquery work.. i thought wordpress had an ........ ahhhh... inhouse one but it did not work at all

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜