In the code snippets provided below, I am attempting to verify the selection of the radio button in Liquid, but I am unable to do so, whereas,

Below is my code snippet where I am attempting to select the radio button from the next group, but unfortunately it is not working as expected. Here is the code snippet:

input[type="radio"] {
  display: none;
}

input[type="radio"]+label span {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: transparent;
  vertical-align: middle;
  border: 2px solid #f56;
  border-radius: 50%;
  padding: 2px;
  margin: 0 5px;
}

input[type="radio"]:checked+label span {
  width: 10px;
  height: 10px;
  background: #f56;
  background-clip: content-box;
}
<div>
  <input type="radio" id="pizza" name="bites" value="pizza">
  <label for="male"><span></span>pizza</label><br>
  <input type="radio" id="cake" name="bites" value="cake">
  <label for="female"><span></span>cake</label><br>
</div>
<div>
  <input type="radio" id="soda" name="liquid" value="soda">
  <label for="male"><span></span>soda</label><br>
  <input type="radio" id="water" name="liquid" value="water">
  <label for="water"><span></span>water</label><br>
</div>

Answer №1

Make sure the for attribute on the label corresponds to the correct radio input id, this is crucial for your code to function properly

input[type="radio"] {
  display: none;
}

input[type="radio"]+label span {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: transparent;
  vertical-align: middle;
  border: 2px solid #f56;
  border-radius: 50%;
  padding: 2px;
  margin: 0 5px;
}

input[type="radio"]:checked+label span {
  width: 10px;
  height: 10px;
  background: #f56;
  background-clip: content-box;
}
<div>
  <input type="radio" id="pizza" name="bites" value="pizza">
  <label for="pizza"><span></span>pizza</label><br>
  <input type="radio" id="cake" name="bites" value="cake">
  <label for="cake"><span></span>cake</label><br>
</div>
<div>
  <input type="radio" id="soda" name="liquid" value="soda">
  <label for="soda"><span></span>soda</label><br>
  <input type="radio" id="water" name="liquid" value="water">
  <label for="water"><span></span>water</label><br>
</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

Matching CSS attribute values with another attribute

Can CSS be used to target elements based on the value of another attribute? For instance: <div data-attr1="abc" data-attr2="def"></div> <div data-attr1="abc" data-attr2="abc"></div> I am looking for something like this (although i ...

What could be causing the jQuery slidedown to malfunction within my table?

My slider is not working when I include a table on my website. The slider works fine without a table, but I need to display members in a table format. Can anyone help me identify the issue with my code? The information needs to be displayed below the nam ...

jQuery insert custom text into HTML and eliminate malfunctioning elements

Using jQuery, I have created a form where the entered text is appended to certain elements. This functionality works correctly. Additionally, I have included a remove link with each added element. When someone clicks on the remove button, it should remove ...

While examining the HTML elements, it appears that they are not in their correct positions

Here's a visual representation of the issue. Imagine my mouse cursor as the red painted mouse because print screen doesn't capture the actual cursor. Oddly enough, the element is being highlighted even though the cursor is not directly positione ...

Creating a dynamic overlay div on responsive block columns using Bootstrap

I am currently working on creating a responsive webpage with 4 blocks using rows and columns, each featuring an image background with an overlay and title. Everything is functioning as expected except for the width of the overlay. My issue can be better u ...

What is the best way to obscure or conceal images of runners?

I am trying to figure out how to blur or hide the runner thumbnails on different streaming sites, such as Prime Video. I typically use the Amino: Live CSS Editor chrome extension or uBlock Origin to manipulate elements on websites. However, I am struggling ...

Unexpected behavior with overflow:scroll in the <body> tag

Take a look at this image and code snippet: <!doctype html> <html> <head> <style> body { border: 1px solid red; padding: 20px; overflow: scroll; ...

What is the best way to achieve complete transparency for an input element?

Is there a way to make the input element completely see-through, allowing the body background image to show through instead of the parent's background color? Sample HTML code: body{ background-image:url("https://upload.wikimedia.org/wikipedia ...

The functionality of both P and H1 tags seems to be malfunctioning

Can someone help me with changing the font family and size of my paragraphs and headings (p and h1)? Any assistance would be greatly appreciated. Feel free to review my code for any other errors as it has been a while since I last coded. html, body { ma ...

The multiple-choice selection tool is not displaying any choices

I am having an issue with my ng-repeat code in conjunction with the jquery multiple-select plugin. Despite using this plugin for a multiple select functionality, the options generated by ng-repeat are not visible. Below is the code snippet in question: & ...

The content's div is not extending completely in the horizontal direction

Just starting out with tailwind CSS and struggling a bit with the design aspect due to my lack of CSS skills. Need some assistance troubleshooting my layout, particularly in making sure the div container stretches to fit the screen size properly. https:// ...

How can I prevent katex from overflowing?

Currently, I am facing a challenge in handling katex equations that overflow in a react native webview. I am attempting to dynamically break the equations into multiple lines to prevent scrolling and display them separately. Any assistance on this matter ...

Having issues with image hover and click functionality

My website has an image with the cursor set to pointer and a function that should show a hidden element when clicked. However, it's not working at all. When I hover over it or click on it, nothing happens. Here is a screenshot of the issue along with ...

How can I extract content nested within another element's id?

Below is the HTML code snippet I am working with: <div id='content'> <div id='price'>$100</div> <div id='another'>something</div> </div> I am able to extract content from the element w ...

Ways to deactivate a button using CSS

I need to use Javascript to disable a link based on its id. By default, the link is invisible. I will only enable the link when the specific id value comes from the backend. HTML <li id="viewroleId" style="display: none;"> <a href="viewrole" ...

Conceal information from view without hiding pseudo content visually

Here's a method I'm using to incorporate icons through the use of :before or :after pseudo content: <span class="icon icon__example is-content-visually-hidden">assistive text</span> Is there a way to hide the assistive text visually ...

Spacing issues in Bootstrap footer on mobile devices when resizing left and right

Recently, I added a new footer to my Twitter Bootstrap website and noticed that when I resize the window, gaps appear on the left and right sides. I understand that this issue is related to the following CSS code... @media (max-width: 767px) { body { ...

I am trying to figure out how to style each box individually, but I'm running into some confusion. There are three different classes to choose from, with the child class

Struggling to style the ten boxes individually? Renaming each class of the box child didn't work as expected? Wondering how to select and style each box with a unique background color? Also facing issues with displaying the logo image on the navigatio ...

Making Angular Treeview nodes more visually appealing with a bell symbol

I am faced with the task of enhancing a tree view display from (http://alexsuleap.github.io/) by updating a node with a bell icon only after other relevant data on the page has been loaded. The specific icon that needs to be displayed is "glyphicon glyphic ...

Display the content as a clickable link using Jquery

Here is the view I have created using .NET MVC3: function DisplayingGrid () { var Geo=$('#ddlGeo').val(); var Vertical=$('#ddlVertical').val(); var Month=$('#ddlMonth').val(); if(Vertical=="All") { var Flag=1; ...