Widget:Guides/PlatformSwitcher: Difference between revisions

From pronounmail wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 23: Line 23:
<script type="module" defer>
<script type="module" defer>
const containers = document.querySelectorAll('.platform-specific');
const containers = document.querySelectorAll('.platform-specific');
switch('windows');
switch_thing('windows');


function switch(value) {
function switch_thing(value) {
   for (const x of containers) {
   for (const x of containers) {
     x.style.display = "none"
     x.style.display = "none"

Revision as of 23:30, 6 December 2024

<form>

 <fieldset>
   <legend>Select your operating system:</legend>
   <label>
     <input type="radio" name="platform" value="windows" checked /> Windows
   </label>
   <label>
     <input type="radio" name="platform" value="macos" /> macOS
   </label>
   <label>
     <input type="radio" name="platform" value="linux" /> Linux
   </label>
   <label>
     <input type="radio" name="platform" value="haiku" /> Haiku
   </label>
 </fieldset>

</form>

<script type="module" defer> const containers = document.querySelectorAll('.platform-specific'); switch_thing('windows');

function switch_thing(value) {

 for (const x of containers) {
   x.style.display = "none"
 }
 document.querySelector('.' + value).style.display = "block";

} </script>