HTML Page Error with RadioButtons

I have encountered an issue in my project with two checkboxes that have background images. When I remove the background image property, the checkbox disappears. Can anyone help me solve this problem?

You can find the code on js fiddle here

Here is the HTML:

<table id="rbtnsslEnabled" class="chkMargin">
    <tbody>
        <tr>
            <td>
                <input id="rbtnsslEnabled_0" type="radio" name="rbtnsslEnabled" value="SSL" />
                <label for="rbtnsslEnabled_0">SSL</label>
            </td>
        </tr>
        <tr>
            <td>
                <input id="rbtnsslEnabled_1" type="radio" name="rbtnsslEnabled" value="TLS" />
                <label for="rbtnsslEnabled_1">TLS</label>
            </td>
        </tr>
    </tbody>
</table>

And here is the CSS:

table {
    width: 100% !important;
    border: none;
    table-layout: fixed;
}
input[type=checkbox]:not(old), input[type=radio]:not(old) {
    width: 40px;
    margin: 0;
    padding: 0;
    opacity: 0;
}
input[type=checkbox]:not(old) + label, input[type=radio]:not(old) + label {
    display: inline-block;
    margin-left: -28px;
    padding-left: 28px;
    background: url('http://s6.postimg.org/4e4im9vkt/checks.png') no-repeat 0 0;
    padding-bottom: 4px;
}
input[type="radio"], input[type="checkbox"] {
    margin: 4px 0 0;
    margin-top: 1px \9;
    line-height: normal;
}
input[type=radio]:not(old):checked + label {
    background-position: 0 -24px;
}

Answer №1

The following CSS code is purposely concealing the default radio button:

input[type=checkbox]:not(old), input[type=radio]:not(old) {
    width: 40px;
    margin: 0;
    padding: 0;
    opacity: 0;
}

specifically

opacity: 0;

This technique is used to create a stylish "green check box" appearance for radio buttons. By hiding the default button and replacing it with a background, removing the background will eliminate the button as well. If you prefer traditional radio buttons, simply delete the opacity: 0; style from this example, or even the entire code block (example)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to transfer Kendo Grid row data to a Kendo popup window within a partial view using jQuery?

I am currently facing a challenge in passing the row data from the Kendo Grid to a partial view that is displayed through a Kendo popup window. Within the partial view, users have the option to upload an image file related to the specific row record. This ...

What is the best way to maximize the width of this element?

Check out my website: There's a div styled with the color #D9D9D9 This is the CSS code: #full_bar { background: #D9D9D9; width: 100%; height: 100px; } I want the div to span across the full width of the website and be stuck to the footer. An ...

Refreshing data in a Bootstrap modal

I am having trouble passing data from a Bootstrap modal to the ul element. Although I can add multiple li elements, only the first one is displayed and it does not change. Can anyone offer assistance with this issue? <ul id="myList"> </ul> ...

How can I display a pointer on a specific table using CSS and the Twitter Bootstrap framework?

[EDIT] I apologize for what may seem like a silly question. I appreciate your time and kindly ask if you could help by voting to close this question. In my website built with Bootstrap, I have multiple tables and on one of them, I would like to display a ...

I am trying to center align this image, but for some reason, it's not cooperating

Attempting to center the image using margin-left: auto and margin-right: auto properties in the code snippet above has proven unsuccessful. The image is not aligning as desired. What could be causing this issue with the code? Are there any other techniq ...

Tips for displaying real-time error notifications from server-side validation using AJAX

Seeking a way to display inline error messages from my Symfony2 Backend without refreshing the page. I considered replacing the current form in the HTML with the validated form containing the error messages returned by the backend through AJAX. However, ...

Difficulty with CSS selector in highlighting checkboxes

After moving the label after the checkbox, this CSS selector is now working. input[type=checkbox]:checked + label { color: red; } <input type="checkbox"><label>Checkbox1</label> However, I want the checkbox to also ...

Ways to secure a floating item onto a backdrop picture

Currently I am working on editing this page. When you hover over the cat, its eyes blink or two black dots randomly appear. My goal is to prevent the random blinking dots from appearing. I want to keep the hover object attached to the cat/background image ...

PHP: Best practices for printing classes and IDs for jQuery rendering

Hey there, I have a question that may sound basic to some, but I need help with echoing this piece of code: echo 'jQuery(document.body).prepend("<div id="notice" class="alert alert-success">Advanced Custom Fields plugin is currently active. & ...

Exploring how to display JSON objects containing spaces in an HTML table

Sorry if this question has been asked already, but I can't find the answer. I'm brand new to html/java/django and struggling with a seemingly simple issue. I am developing a web application that retrieves json data from firebase using python/pyre ...

Problem with using .append and .prepend

Hey there! I've encountered a strange issue while using the .append and .prepend methods in JQuery. I'm quite familiar with these methods, but something odd is happening when I implement this code: $("#nashgraphics-menu ul li a.toplevel-a") .pr ...

When using angular.less, the @import feature is functioning correctly but a 404 error is displayed in the

Currently, I am working on a project using AngularJS along with angular.less. To centralize all my constants, I have stored them in one .less file and imported it at the beginning of all my other less files using a relative path: @import "constants" Even ...

How can you identify when an input value has been modified in Angular?

For my current project, I am developing a directive to be used with a text input field in order to format currency input. This directive has two HostListeners - one for when the input loses focus and one for when it gains focus. When the blur event occurs, ...

Steps to disable all fields if the previous field is set to its default value and the default value is currently selected

As a newcomer to AngularJS, I have successfully disabled fields based on previous field selections. However, my goal is to set the default value of "ALL" for all fields (country, state, city). If the country value is set to "ALL," then the state and city ...

December Monthly Calendar Edition

My code using jQuery FullCalendar was working perfectly until December rolled around. For some reason, the events function is setting calMonth to 0 and calYear to 2018. I can go back to November without any issues, but I do have events scheduled for Decemb ...

The jqgrid setCell function will erase any previously set formatter

When I use the setCell method in my jqgrid to set values for textboxes, it ends up removing the textbox formatter. Is there a way to keep the textbox intact and only replace the value? $("#acc_jqgrid").jqGrid('setCell', sel_id, 'jqgrid_accD ...

Sending a jQuery form to a node.js connect-form involves passing the form data through AJAX to

On the server side, I have implemented the following function as an expressjs middleware: function objCreation(req, res, next){ req.form.complete(function(err, fields, files){ if (err) { next(err); } else { // Set params in request ...

Leveraging the variables declared within functions.php in WORDPRESS

I am facing an issue with a variable that is being retrieved from jQuery into php in my functions.php file. Unfortunately, I am unable to utilize it on a page. When I try to echo it from functions.php, it shows up in the console in chrome, but with a 0 a ...

Ensure that the remaining space on the page is filled by utilizing 2 divs

I am currently in the process of developing a website that needs to be responsive on all pages. The layout consists of 5 divs positioned horizontally. The three middle divs have fixed sizes - 200px, 400px, and 200px respectively. However, I am facing a cha ...

Optimizing SEO with asynchronous image loading

I've been developing a custom middleman gem that allows for asynchronous loading of images, similar to the effect seen on Medium. Everything is functioning smoothly, but I'm uncertain about the impact on SEO. The image tag in question looks like ...