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 7821015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:30:46+00:00 2026-06-02T07:30:46+00:00

I want create a plugin in jquery. this is my html code : <div

  • 0

I want create a plugin in jquery.

this is my html code :

<div class="popup">
  <div class="bc_top">
    <div class="bc_tl"></div>
    <div class="bc_tm"></div>
    <div class="bc_tr"></div>
  </div>
  <div class="bc_middle">
    <div class="bc_ml">
      <div class="bc_mr">
        <div class="bc_cnt">




        </div>
      </div>
    </div>
  </div>
  <div class="bc_bottom">
    <div class="bc_bl"></div>
    <div class="bc_bm"></div>
    <div class="bc_br"></div>
  </div>
</div>

I want insert above code around my tag, my tag html content should insert into div.bc_cnt , so I write a jQuery Plugin :

$.fn.popup = function() {
    $(this).before('<div class="popup">\
                      <div class="bc_top">\
                        <div class="bc_tl"></div>\
                        <div class="bc_tm"></div>\
                        <div class="bc_tr"></div>\
                      </div>\
                      <div class="bc_middle">\
                        <div class="bc_ml">\
                          <div class="bc_mr">\
                            <div class="bc_cnt">'+$(this).html()+'</div>\
                          </div>\
                        </div>\
                      </div>\
                      <div class="bc_bottom">\
                        <div class="bc_bl"></div>\
                        <div class="bc_bm"></div>\
                        <div class="bc_br"></div>\
                      </div>\
                    </div>');   

}

and I use like this :

<scritp>
    $('div#pop').popup();
</script>


    <div id="pop">
        this is a test
    </div>

everything is OK but this code insert only html content of selected tag to popup with $(this).html(), I want insert complete tag in my popup (I mean <div id="pop">this is a test</div>)

What should I do?

P.S: sorry for my bad English.

  • 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-06-02T07:30:48+00:00Added an answer on June 2, 2026 at 7:30 am

    You can clone the orig element, append it to a temp div and get the html of the div. See below,

    $('<div>').append($(this).clone()).html()
    

    DEMO

    If you want to remove the original, you can use .remove at the end of the function as $(this).remove()

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

Sidebar

Related Questions

I'm using this Jquery plugin http://t.wits.sg/misc/jQueryProgressBar/demo.php# and I just want to create a default
I'm using the ajaxform jQuery plugin to create ajaxed HTML forms and want to
I'm new to jQuery but want to use this form validation plugin: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ In
In this jquery plugin: http://www.stahs.org.uk/jquery.infinitecarousel.bak There's this line: $(obj).append('<div id=textholder'+randID+' class=textholder style=position:absolute;bottom:0px;margin-bottom:'+-imgHeight*o.textholderHeight+'px;left:'+$(obj).css('paddingLeft')+'></div>'); Problem is
I'm using a jquery flowplayer tools plugin http://flowplayer.org/tools/tooltip.html 1)I want a tooltip to be
I want to create a plugin 'myPlugin' which simply add some text to a
I want to create a plugin called 'myPlugin'. Which method should I use and
I am using the jQuery BBQ: Back Button & Query Library plugin to create
i'm trying to create my first jQuery plugin. i got a prototype function called
This is a simple question. I want to create an inline calendar that does

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.