Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6190321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:34:06+00:00 2026-05-24T02:34:06+00:00

I created a jquery plugin which inserts the element #tweetFeed , along with some

  • 0

I created a jquery plugin which inserts the element #tweetFeed, along with some other things. When I call my plugin, and then try to insert an element into #tweetFeed in the callback, it doesn’t insert it. Any ideas why?

Here’s the code that is calling the plugin:

$(document).ready(function() {

    // add the sidebar plugin
    $('html').social(function() {

        //doesn't print anything...ARGGG!!
        console.log('#tweetFeed = '+ $('#tweetFeed').parent().html());
        //$('#tweetFeed').append("<p>TEST</p>");
        //alert("test alert");  // this works now!

        //this line does NOT work. Why?
        $('#tweetFeed').append('<script src="http://widgets.twimg.com/j/2/widget.js"></script><script>new TWTR.Widget({version: 2,type: \'profile\',rpp: 4,interval: 6000,width: 250,height: 280,theme: {shell: {background: \'#333333\',color: \'#ffffff\'},tweets: {background: \'#ffffff\',color: \'#444444\',links: \'#e02046\'}},features: {scrollbar: false,loop: false,live: false,hashtags: true,timestamp: true,avatars: false,behavior: \'all\'}}).render().setUser(\'CSuitesIndepend\').start();</script>'); 
    }); 

});

You can see a live example of my problem here

EDIT: After adding @Nicos suggestion, my plugin looks like this:

(function($) {
    $.fn.social = function(callback) {

        var defaults = {

        };
        var options = null;
        var settings = $.extend({}, defaults, options); 

        // stuff goes on here


        if(typeof callback == 'function'){
            callback.call(this);
        }
        return this;
    }
})(jQuery)

The only problem is when I try to append my twitter js code, I get errors which you can see here . What is causing these errors? The alert works just fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:34:07+00:00Added an answer on May 24, 2026 at 2:34 am

    Look, the declaration of your plugin must recieve the function that you want do recieve…

    Please, remove that code on the end of your plugin. Change your plugin to the latest version before you made that changes.

    after that you must change this 2 lines:

    1. $.fn.social = function() {
    2. return this;

    the first one will look like this:

    $.fn.social = function(callback) {

    and the second one will be looking lke this:

    if(typeof callback == 'function'){
      callback.call(this, data);
    }
    return this;
    

    this last bit of code ensures that your plugin will call tha callback function, if you don`t do that the callback is never called

    if you want the code already changed look here

    P.S. i will delete this paste to protect your plugin, just warn me when you read it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NOTE: I have now created a jQuery plugin which is my attempt of a
I have created a nice tooltip box using JQuery and I used some plugin
I'm using the plugin http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ to create tooltips with JQuery but I can't created
A while back I created a lightbox plugin using jQuery that would load a
I am using the listen plugin for jQuery for binding events to dynamically created
I am using the jQuery Tools Scrollable plugin - http://flowplayer.org/tools/scrollable.html#navigator I have created a
So I'm using the ProgressBar JQuery plugin ( http://t.wits.sg/misc/jQueryProgressBar/demo.php ) to create some static
I created a wordpress plugin (say P1 ) in which I used fancybox (a
I'm using the jQuery tablesorter plugin to sort a table, which assigns .click() handlers
I am trying to learn the jQuery validation plugin, so I created the simplest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.