An effective method for utilizing a multiple choice input (presented as buttons) for entering data into a database using html, css, and js

I'm trying to figure out the coding process using buttons and input It's giving me a result, but only allows for a single choice

Although I have limited experience with this, my goal is to create a multiple choice selection for days of the week and a single choice for weekly frequency. This way, I can utilize the data through JavaScript on a page that dynamically adds more "day-containers" based on user selections from the buttons.

Thank you in advance for your assistance!

I've attempted to use radio buttons and checkboxes, but struggled to style them as buttons while also including text within the button area. As mentioned, my experience is somewhat limited in this area, but I am eager to learn and improve.

Answer №1

Always remember not to alter the HTML for styling purposes, as there are alternative ways to achieve the desired style. For example, to make radio buttons appear as buttons, simply adjust the CSS styling. If you wish to hide the dot associated with radio buttons, you can use either opacity: 0.001; or appearance: none

.day-selector label{
    border-style: solid;
    width:200px;
}
.day-selector label:hover {
    background: red;
}
.day-selector input[type="radio"] {
    appearance: none;
}
    
.day-selector input[type="radio"]:checked + label {
    background: yellow;
}

I came across this helpful example in a previous post on Stack Overflow

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

The text exceeds the width of the paragraph

Something very odd is happening, a rare occurrence in my over 20 years of web development experience. The text within the paragraph seems to be overflowing its boundaries: https://i.sstatic.net/bmB1zg7U.jpg My client specifically requested the Duffy Scri ...

Tips for submitting a form and retrieving session count without the need to refresh the page after submitting the form

I have set up a form that includes hidden input fields to send data to a PHP script. The script stores the values in an array of sessions by using AJAX to reload the page. Once the data is submitted successfully, an HTML alert message is displayed in <p ...

"Uncaught ReferenceError: Rawdata.some is not defined, and a table design

Currently, I am in the process of developing a basic table using data retrieved from the backend via an API call with Ant Design in React. The version of Ant Design I am using is: "antd": "^5.1.1", My approach involves making an API ...

Trigger a Jquery sound when an HTML result is found and displayed

I am using a Jqgrid to display a table. Within the "return" column, along with other data, there is a span element like the following: <span class="return" id="ret0>4.25%</span> My webpage contains multiple instances of these spans: < ...

Retrieving the length of an array from Firebase Firestore

Recently, I dove into a project that involves using Next JS and Firebase. After successfully storing data in Cloud Firestore, I encountered an issue when trying to retrieve the length of an array from the database. Below is an image illustrating the data s ...

Track how long a webpage element remains in view using Seleniumwebdriver

After interacting with the page, a loader briefly appears and then disappears from the page html. <div class="loader"> <img src="/static/media/loading-anim-windmill.9f645983.gif" alt="loading"><p>Loading...&l ...

What is the best way to utilize a variable retrieved from a mysql connection in NodeJS within an asynchronous function?

My current project involves scraping a website using Puppeteer. I am aiming to extract the date of the last post from my database and compare it with the dates obtained during the scrape. This way, I can determine if a post is already present in the databa ...

Unable to apply nativeElement.style.width property within ngOnChanges lifecycle method

My current task involves adjusting the width of containers while also monitoring changes in my @Input since the DOM structure is dependent on it. @Input('connections') public connections = []; @ViewChildren('containers', { read: Elemen ...

Copying and pasting seems to be causing issues with the functionality of modals and collapsing on Bootstrap

I'm encountering an issue with Bootstrap. After copying and pasting a page that had a modal and a collapse feature, the functionality no longer works on the copied page. However, it works perfectly on the original page. Any idea why this might be happ ...

React maintains the state of just a single element within an array at a time

I'm faced with a roadblock while developing my covid19 application. The app should display a list of countries on the left side of the screen, allowing users to add any number of countries to the right side for more detailed covid data. I'm still ...

Issue with jQuery: Function not triggered by value selection in dynamically created select boxes

I am in need of some assistance with my code that dynamically generates select drop down menus. I want each menu to trigger a different function when an option is selected using the "onchange" event, but I am struggling to implement this feature. Any hel ...

The jQuery validation feature is failing to function properly within a bootstrap modal

I'm facing an issue with the jQuery validation plugin in my express app sign-up form that uses Bootstrap for the front-end. Despite setting rules and messages for name, email, and phone number fields, the validation is not functioning correctly. Below ...

Fuel Calculation - Unable to pinpoint the error

My JavaScript Code for Calculating CO2 Emissions I'm working on a program that calculates how much CO2 a person produces per kilometer. This is part of my school project and I'm still learning, so please bear with me... I also just signed up on ...

Size your grids in HTML5

I have designed an HTML5 grid for a website that consists of "big" squares containing 10 smaller squares each. However, I actually need there to be only 5 squares within each "big" square. Unfortunately, my skills in HTML5 are limited and I am struggling t ...

Issue with Linq to Sql

I am facing a challenge with connecting two tables, Users and Queries, through a foreign key (UserId) in the Queries table. My goal is to add queries that have been added by a specific user named "Bob" to all users. Below is the code snippet I am currentl ...

Transfer JSON data from Python Requests to JavaScript within Django views.py

I have a Python script that retrieves JSON data and parses it: from django.http import HttpResponse import json, requests def fetch_data(request): context = {} platformUrl = 'https://www.igdb.com/api/v1/platforms' platformReq = requ ...

Unexplained Reference Error in Next.js Typescript: Variable Accessed before Initialization

I am currently working on an admin website and encountered the error Block-scoped variable used before its declaration.. I will provide details using images and code. This is my first time seeking help on StackOverflow. Error Message: Block-scoped variab ...

How to delete an item from an array of objects using ReactJS

Hello there, I am currently learning about React Js and I have encountered a problem. I need to remove an element from an array. Here is the structure of my array: array = [{ Id: "L0", value="asas"}] The array that I want to work with is stored in this ...

Creating styles for different screen sizes including mobile devices, low-resolution desktops, and high-resolution desktops

One of the techniques I'm using involves analyzing both the horizontal and vertical screen dimensions to differentiate between mobile devices and desktops, as well as distinguish high-resolution from low-resolution desktop displays. In order to achie ...

jQuery tooltip box not functioning correctly

When the mouse enters on li a, the tooltip box (class .show_tooltip) is appearing on the left. I want each tooltip box to display just above or to the left of the link that the mouse is on. The links need to stay on the right as they are now, so please do ...