Guide to adjusting brightness in radio buttons with CSS in jQuery mobile

I'm attempting to adjust the brightness of an existing radio button when it's turned off using CSS in jQuery mobile. Here is what I've tried in my HTML file -

    <style>
  .ui-grid-b .ui-block-b: flip-select.label{
  text-indent: 60%;
  }
  #flip-select{
  text-indent: 60%;
  }
  #radio-choice-h-2a:true{
  filter:brightness(50%);
  }
  .ui-radio .ui-btn.ui-radio-off:after {
  filter: brightness(50%);
  }
  </style>

This section shows the HTML code for the radio button in jQuery mobile 1.4.5 demos -

    <div class="ui-grid-b">

  <div class="ui-block-a"><!--row 1 block a-->
    <!--radio button 1-->
    <fieldset id="radio-choice-h-2" data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
      <legend>NLED</legend>
      <input name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked" type="radio">
      <label style="background-color: #ff0000" for="radio-choice-h-2a">ON</label>       

Even after adding the internal CSS style element, I'm not seeing any changes. Am I making a mistake? I have come across similar posts. However, my goal is to modify an existing radio button.

This customization is intended for touchscreens on a webpage.

Answer №1

To adjust the brightness or alter the color of a radio button, you can easily modify the background color using this code snippet.

.ui-grid-b{
  margin: 10px;
}

fieldset {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    display: inline-block;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    margin-right: 40px;
}
fieldset input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

label:after {
  content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 4px;
    height: 15px;
    width: 15px;
    border: 1px solid #383838;
    border-radius: 50%;
}

label:before {
    content: "";
    position: absolute;
    display: none;
}
fieldset input:checked + label:before {
    display: block;
}
fieldset label:before {
 top: 56%;
    left: 7px;
    width: 11px;
    display: none;
    height: 11px;
    border-radius: 50%;
    background: #d61722;
}
<div class="ui-grid-b">

  <div class="ui-block-a"><!-row 1 block a-->
    <!--radio button 1-->
    <fieldset id="radio-choice-h-2" data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
      <legend>NLED</legend>
      <input name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked" type="radio">
      <label style="background-color: #ff0000" for="radio-choice-h-2a">ON</label> 
      </fieldset>
      </div>
      </div>

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

Unable to view HTML without an internet connection

I have encountered an issue where my files work fine when uploaded to an online server, but do not work when accessed locally offline. An error message about a cross-origin issue appears. How can I solve this problem? Error message: Security Error: Conte ...

Merging Fewer with Visual Studio 2012

Combining all Less files into a single stylesheet? After following the instructions in the above link, I have successfully merged my Less files together for easier CSS reading during development. However, I would like to ensure that end users only need to ...

What is the method for altering the value of a class within another class?

Check out this piece of code: <div id="one"> <div id="two"> <div class="cell_pad"> </div> </div> </div> How can you instruct CSS to modify the value of class "cell_pad" within the container of id="one"? Th ...

Tips for creating multiple popups using a single line of JavaScript code

I am new to JavaScript and I am attempting to create a popup. However, I am facing an issue in opening two divs with a single line of JavaScript code. Only one div opens while the other remains closed despite trying various solutions found on this website. ...

I have managed to update the Immutable and Primitive Data-Types in JS. Now, the question arises - are these truly Primitives or are the concepts in

In JavaScript, there are 4 primitive data types that store values directly: String, Number, Boolean, and Symbol. I am excluding undefined and null from this list as they are special data types with unique characteristics. One key feature of primitives is ...

After pressing submit, any associated links should automatically open in a separate tab

I have a homework assignment that requires creating a form with multiple elements, including a checkbox. Once this checkbox is checked, the links displayed on the resulting page should open in a new tab. The catch? I can only use HTML and CSS - no JavaScri ...

Interpolation within ngStyle allows dynamic styling to be applied in

When creating a column component for use within a grid in Angular, I am struggling with implementing a media query using ngStyle. Here is what my code looks like so far: import { Component, Input } from '@angular/core' const smMin = '48em& ...

Resolving PHP problem with passing variables in Jquery click event

I am currently working on Core PHP. Whenever I click on a div, data is retrieved and stored in a variable. I want to check this variable against a database query, and if it matches, all the records will be displayed. Can anyone provide guidance on how to a ...

Modal box fails to refresh content

Currently, I am in the process of learning how to modify my blog using a modal window. However, when I click on the edit button within the modal, an error message 'Failed to execute 'fetch' on 'Window': Invalid name' appears i ...

After the form is successfully submitted, you can remove the required attribute

Upon clicking the submit button of a form, an input box is highlighted with a red border if empty. After successful jQuery AJAX form submission, a message "data submitted" is displayed and the form is reset causing all input fields to be highlighted in red ...

What is the best way to design an element that exceeds the size of my physical body

I am currently working on creating a table that needs to be larger than the body and centered. Let me provide some more information. Below is my simplified HTML code : <body> <div id="one"> <div> <tab ...

Text positioned on the right side of the image, appearing to hover above

After finding a helpful example on Stack Overflow, I successfully implemented a similar layout for product boxes in a JSFiddle. I then replicated the CSS and HTML almost exactly on my Wordpress blog, but encountered an issue where the title, description, a ...

What is the best way to ensure that this header remains adaptable to different screen

Looking for guidance on creating a fluid and responsive header design similar to the curved images shown at this link or this link. How can I ensure that my design maintains its shape without distortion when viewed on different devices? Any suggestions a ...

Angular 4 encounters performance issues when rendering numerous base64 images simultaneously

I'm currently working on a private project that involves using Angular 4 (specifically version 4.1.2). One issue we're facing is related to rendering multiple base64 images on an HTML page. The performance of the application significantly drops w ...

Asking for information regarding RESTful API

Could you please assist me in identifying the most suitable technologies for integrating a RESTful API into an HTML and CSS website? The primary objective is to enable the website owner to easily log in and add news entries about their business. Addition ...

Why is it that when I click outside of the <html> element, the click event bound to the <html> element is triggered?

const html = document.querySelector('html') const body = document.querySelector('body') body.onclick = () => { console.log('body clicked') } html.onclick = () => { console.log('html clicked') } document. ...

What is the best way to invoke an external JavaScript source using another JavaScript source?

I am trying to connect 2 different files together. file1.php and document.html file1.php has the following code in it: document.writeln('< script src="https://www.googletagservices.com/tag/js/gpt.js"> googletag.pubads().definePassback ...

Problem with CSS in the Internet Explorer 8 browser encountered

While working on a project, I encountered an unexpected design issue on a client's machine that has Internet Explorer 8 installed. Interestingly enough, when testing on my own machine with IE 9 and using F12 to switch to compatibility mode for IE 8/7, ...

When working on a small screen, Bootstrap generates divs one by one

Hey there! I've been working with bootstrap CSS library version 5.1.3 and I'm trying to create a simple card layout where there's an image on the left side and text on the right side. Everything looks great on a large screen, but I'm st ...

Is it possible to obtain the index of a table row using querySelector?

Is it possible to find the rowIndex of the first occurrence of a table row within the #myTable using JavaScript? http://jsfiddle.net/bobbyrne01/fmj6np6m/1/ html .. <table id="otherTable"></table> <table id="myTable"></table> js ...