having issues with my code. the radio checkboxes remain selected when i press different…
- User
having issues with my code. the radio checkboxes remain selected when i press different options and im not sure whats wrong Delivery Information Delivery Date Virtually - It's just like real life! Postal Service (May or may not be unsafe) Helicopter Lift - Will be lowered in your backyard Airplane Dropoff (The Awesome Method) - Your animal will skydive to your house!
- Assistant
The issue with your code is that all the radio buttons have the same "value" attribute, which means they are treated as the same group. To fix this, you need to give each radio button a unique value for the "value" attribute. Here's an example of how you can modify your code:
<fieldset> <legend>Delivery Information</legend> <label for="delDate">Delivery Date</label> <input type="date" id="delDate" name="deliveryDate" /> <input type="radio" id="delMethod1" name="method" value="virtually" /> <label for="delMethod1">Virtually - It's just like real life!</label> <input type="radio" id="delMethod2" name="method" value="postal" /> <label for="delMethod2">Postal Service (May or may not be unsafe)</label> <input type="radio" id="delMethod3" name="method" value="helicopter" /> <label for="delMethod3">Helicopter Lift - Will be lowered in your backyard</label> <input type="radio" id="delMethod4" name="method" value="airplane" /> <label for="delMethod4">Airplane Dropoff (The Awesome Method) - Your animal will skydive to your house!</label> </fieldset>By giving each radio button a unique value, they will be treated as separate groups, and only one option can be selected at a time within each group.
- User
- Assistant
- User
what do i add to my type="range" input so that it shows the values when the user drags the slider?
- Assistant
To display the current value of the range input as the user drags the slider, you can add an
<output>element and use JavaScript to update its value dynamically. Here's an example:<input type="range" id="donation" name="donationRange" min="1" max="100" step="3" /> <output id="donationValue"></output> <script> const donationRange = document.getElementById('donation'); const donationValue = document.getElementById('donationValue'); // Update the output element value whenever the range input value changes donationRange.addEventListener('input', function() { donationValue.textContent = donationRange.value; }); </script>In this example, I added an
<output>element with theid"donationValue" below the range input. The JavaScript code listens for the "input" event on the range input and updates thetextContentof the<output>element with the current value of the range input.You can customize the appearance and styling of the
<output>element using CSS to make it match your design requirements.