/    Sign up×
Community /Pin to ProfileBookmark

adding a div with .load()

Here is the page: [url]http://bit.ly/cnqh1r[/url]

I have the following code set up in the footer:

[CODE]jQuery(“#dsq-content”).load(function() {
jQuery(“.dsq-comment”).prepend(“<div class=’comment-point’></div>”);
});[/CODE]

Basically, I’m trying to add a div to .dsq-comment once #dsq-content has been loaded. I can’t get it to work for some reason and would appreciate any help.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 10.2010 — There is no [I]dsq-conten[/I]t class nor id
Copy linkTweet thisAlerts:
@cpkid2authorOct 10.2010 — @Fang

Please check this image: http://img181.imageshack.us/img181/3037/dsqcontent.jpg

I highlighted where #dsq-content is.
Copy linkTweet thisAlerts:
@FangOct 11.2010 — Your method will not work here. Either use a callback on the Comments script or use a loop to wait for the comments to appear.
Copy linkTweet thisAlerts:
@cpkid2authorOct 11.2010 — I appreciate the help, Fang. Would using a callback work even if I'm using a plugin for the comments (Disqus) like I am now? I'd rather not mess with the core files for easy upgrades. How would I use a loop to wait for the comments to appear?
Copy linkTweet thisAlerts:
@FangOct 11.2010 — [CODE]jQuery(document).ready(function($){
intervalID = setInterval(loopWait, 1000);
});

function loopWait() {
if (jQuery(".dsq-comment").length>0) {
clearInterval(intervalID);
jQuery(".dsq-comment").prepend("<div class='comment-point'>foobar</div>");
}
}
[/CODE]

Check the Disqus documentation, there could be a callback function or it will be added soon.
×

Success!

Help @cpkid2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...