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

  • SEARCH
  • Home
  • 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 8704161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:01:54+00:00 2026-06-13T03:01:54+00:00

This is my js fiddle and this is the original version of it Code

  • 0

This is my js fiddle

and this is the original version of it

Code is like:

HTML:

<fieldset  class="onoffswitch">
    <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="xmonoffswitch">
    <label class="onoffswitch-label" for="xmonoffswitch">
        <div class="onoffswitch-inner">
            <div class="onoffswitch-active">Published</div>
            <div class="onoffswitch-inactive">Unpublished</div>
        </div>
        <div class="onoffswitch-switch"></div>
    </label>
</fieldset >
<div class="result"></div>

CSS:

.onoffswitch {
    position: relative; width: 182px;
    border: 0px;
    -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
    display: none;
}
.onoffswitch-label {
    display: block; overflow: hidden; cursor: pointer;
    border: 2px solid #FFF3E4; border-radius: 50px;
}
.onoffswitch-inner {
    width: 200%; margin-left: -100%;
    -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s;
    -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner > div {
    float: left; width: 50%; height: 41px; padding: 0; line-height: 41px;
    font-size: 20px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: normal; font-style: italic;
    -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
.onoffswitch-inner .onoffswitch-active {
    padding-left: 14px;
    background-color: #F0B78B; color: #E67817;
}
.onoffswitch-inner .onoffswitch-inactive {
    padding-right: 14px;
    background-color: #F0B78B; color: #999999;
    text-align: right;
}
.onoffswitch-switch {
    width: 38px; height: 38px; margin:1.5px;
    background: #A1A1A1;
    border: 2px solid #FFF3E4; border-radius: 50px;
    position: absolute; top: 0; bottom: 0; right: 137px;
    -moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
    -o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 0px;
    background-color: #E67817;
}

This is basically a switch button which has two states: published (On) and Unpublished (off). I want to fetch the current selected state through JQuery but not able to get it. Will anybody tell what could be the JQuery snippet for this?

  • 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-13T03:01:56+00:00Added an answer on June 13, 2026 at 3:01 am

    The script should be :

    function getStatus(){
        // will return true in case of "ON" and false in case of "OFF"
        return $("input#xmonoffswitch").is(":checked");
    }
    

    DEMO

    Hope this will help !!

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

Sidebar

Related Questions

I have this fiddle: http://jsfiddle.net/yub2B/4/ HTML: <input type=text /> <input type=text /> <input type=text
I have this fiddle : http://jsfiddle.net/XjeCf/1/ that works like I want and this one
I made a page which is saved in this fiddle (original fiddle link). Here
I have a class that goes like this: function Element(){ this.changes = {}; }
In this fiddle http://jsfiddle.net/dAHqe/2/ I've created examples for the 2 main uses (that I've
In this fiddle when user drags a div auto scroll works in chrome but
In this fiddle I'm just trying to return true : http://jsfiddle.net/WCFtp/ for jQuery key
see this fiddle . This upon running gives an error in console. I'm currently
Referencing this Fiddle ( http://jsfiddle.net/j5uGN ), how can I toggle a clicked image's border
Please refer to this fiddle . While scrolling down, the table cells appear in

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.