开发者

Javascript Code not working when on my site

开发者 https://www.devze.com 2023-04-10 09:05 出处:网络
I recently installed a code on my website to insert text at the position of the cursor. It works perfectly when on its own: http://www.penpalparade.com/test.php

I recently installed a code on my website to insert text at the position of the cursor. It works perfectly when on its own: http://www.penpalparade.com/test.php

It isn't however working with my site as a whole: http://www.penpalparade.com/jobs.php

I've tried to fix it but have been unsuccessful, could someone please please help开发者_运维问答 me at solving it because I've been at it for hours.


Firebug is showing several errors.

$(".tooltipbox a[title]").tooltip is not a function

jQuery("textarea[class*=expand]").TextAreaExpander is not a function

"NetworkError: 404 Not Found - http://www.penpalparade.com/css/images/img02.jpg"

This code is referenced before jQuery:

<a href="javascript:;" onclick='$("#message").insertAtCaret("*****");'>*****</a>

To get it out the door move your jquery src reference to the top (in the head tag).

Or to do it correctly. Just above your closing body tag:

$(document).ready(function() {
  $("#whatever").click(function() {
     $("#message").insertAtCaret("*****");
  });
});

Change your Html to:

<a id="whatever" href="">*****</a>

This allows you to separate the behavior from the content.

0

精彩评论

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