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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:33:30+00:00 2026-05-27T02:33:30+00:00

I am trying to create my own styled checkbox jQuery plugin. What I want

  • 0

I am trying to create my own styled checkbox jQuery plugin. What I want to do is hide the check-box which is working and append a span after the check-box but the span is not adding after the check-box. Why is this?

SETUP

var checkBox1 = $("<input type='checkbox'/>");
$(checkBox1).genCheckBox();
$(divBGContainer).append(checkBox1);

PLUGIN

(function($) {

    $.fn.genCheckBox = function(settings) {

        var def = {

            height: 15,
            width: 15

        };


        $(this).css("display", "none");


        var span = $("<span/>");
        $(span).insertAfter(this);

    }

})(jQuery);
  • 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-27T02:33:31+00:00Added an answer on May 27, 2026 at 2:33 am

    The problem is probably you selector. I guess you want to get all checkboxes on your page and turn them into your custom checkboxes, right?

    Try this instead:

    $("input[type='checkbox']").genCheckBox();
    

    Edit:

    Notice that you probably want to make sure that your plugin can receive more than one element. So you should probably loop over the elements, and perform your actions on them one by one.

    Something like this:

    (function($) {
    
        $.fn.genCheckBox = function(settings) {
            var def = {
                height: 15,
                width: 15
            };
    
            this.each(function() {
               $(this).hide();
               $("<span/>").insertAfter(this);
            });
        }
    })(jQuery);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create my own error window for the project I am working
I'm trying to create my own plugin. But I'm having trouble getting things right.
I am trying to create my own torrent tracker but dont know how to
Right now I'm trying to create my own tiny MVC (just for practice and
Ok, I've been trying to create my own GKSession object and the delegate method
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I created my own module called cssswitch. I'm trying to create my own html
Live demo: http://jsfiddle.net/stapiagutierrez/KKdsb/29/ I'm just trying to create my own star rating UI for
I am trying to create a site which uses similar technology to that of
I am trying to create my own std::string wrapper to extend its functionality. But

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.