How to display ‘All’ with value of ” when using MUI TextField with prop of select?

With regular Select in MUI I am able to use displayEmpty to display 'All' with the value of ''. However I need to use TextField from MUI with a prop of select. Is there a way to do this same functionality of displayEmpty with this? The reason for this is when 'All' is selected, the TextField shows nothing even though it is selected and I made sure that the following have these values: display:'All' and value:''.

 <FormControl size="small">
        <TextField
          InputLabelProps={
            placeholderColor && { style: { color: placeholderColor } }
          }
          InputProps={
            placeholderColor && { style: { color: placeholderColor } }
          }
          className="filterTextField"
          fullWidth
          label={placeholder || ''}
          onChange={(e) => setValue(e.target.value)}
          select
          size="small"
          value={value}
          variant="outlined"
        >
          {options?.map((x, i) => (
            <MenuItem key={x.display + i} value={x.value}>
              {x.display}
            </MenuItem>
          ))}
        </TextField>
      </FormControl>

SystemJs Rollup unable to resolve bare specifiers

I have a bit of a unique code structure in that I’m loading vue components directly in legacy web pages. This is not a SPA.
So I have an ‘entry’ typescript file named ‘home-page.ts’ which includes a function that injects HTML into the page for Vue rendering. A simplified example looks like below:

import ArticleCardsComponent from "vue-components/article-cards.vue";

const containerId = 1234;
const $elSection = $(`<section id="${containerId}" class="${containerClasses}"></section>`);
const $elContainer = $(`<div class="container"></div>`);
$elContainer.append(`<article-cards-component
                header-text=""
                :search-criteria="searchCriteria"
                :show-button-only="true"
                class="mt-3"
            ></article-cards-component>`);

$elSection.append($elContainer);
$topContainer.append($elSection);

new Vue({
   el: "#" + containerId,
   components: {
       ArticleCardsComponent
   },
   data() {
      return {
        contentCards: initContentArticleCards,
        headline: sectionHeadline,
        searchCriteria: searchQueryForButton
    };
  }
});

Now when I run my entry file through rollup with system format I get output such as:

// rollup systemjs bundle output
System.register(['./navigation-_7K7-B5l.js', 'vue-components/article-cards.vue'], (function () {
    'use strict';
    var getJSON, buildPageEndpointUrl, renderPageContainers, toastError;
    return {
        setters: [null, function (module) {
            getJSON = module.d;
            buildPageEndpointUrl = module.f;
            renderPageContainers = module.r;
            toastError = module.t;
        }, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
        execute: (function () {

            /// do soemthing

        })
    };
}));

Which ends up erroring saying it cannot resolve the bare specifier to the vue component.

Here is my rollup config:

// rollup.config.js
import { defineConfig } from 'rollup';
import { cleandir } from "rollup-plugin-cleandir";
import { nodeResolve } from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import vuePlugin from 'rollup-plugin-vue'


export default defineConfig({
    input: {
        "global": "scripts/global.ts",
        "home-page": "scripts/entry-points/home-page.ts"
    },
    output: {
        dir: "wwwroot/dist",
        format: 'system',
        entryFileNames: "[name].js"
      },
    external: ['jquery'],
    plugins: [
        cleandir(),
        nodeResolve(),
        typescript(),
        vuePlugin(/* options */)
    ]
});

Please let me know what I may be doing wrong so that SystemJS can properly load the bare specifiers.

Javascript not changing array value correctly when using .map [closed]

Hello this code is not setting the path[1] correctly, and i am not understanding why.

                this.Pancake.map(token => {


                let path = [];
                path[0] = token.contractAddress;
                path[1]  = token.contractAddress != this.BusdBSC ? this.BusdBSC : this.UsdtBSC;
                console.warn(path[1])
            
            });

even if the check returns false it will always set path[1] to the first variable after the “?”, i cannot understand what’s wrong here…

how to use Javascript in Hackerrank and doselect [closed]

Im stuck in a problem.

DESCRIPTION
Charlie is crazy about unique things. He never likes stuffs that are same. This craze he got has got him into trouble many times. His teacher hates this attitude and decides to teach him a lesson. She tries to give him the taste of his own medicine. She asks him to tell the total number of N digit numbers in which all the numbers are distinct.

Who doesn’t love unique stuff! Help him do this little assignment.

Input Format

First line contains the number of testcases, T (1 <= T <= 100000).
The second line of the input contains a number N (1 <= N <= 9).
Output Format

For each testcase, print one number on each line denoting the answer.
Sample Test Cases
Sample Input

1
1
Sample Output

9

Explanation

There are 9 distinct 1 digit numbers. (1 – 9)
Consider a 3 digit number, the first place (hundred’s place) can be occupied by any of the 9 non-zero numbers. The second place can be occupied by any of the remaining 9 digits (including zero). The last spot (one place) can be filled by any of the 8 remaining numbers.

after spending hours this was the best i could do

`

 process.stdin.on('data', function(chunk) {
    // Convert the input chunk to a string and split it into lines
    var lines = chunk.toString().split('n');

    // Parse the first line as an integer (number of test cases)
   

 var T = parseInt(lines[0]);

// Iterate over each test case
for (let i = 1; i <= T; i++) {
    var N = parseInt(lines[i]);

    let result = 9;
    let places = 9 - N;
    let a = 1;
    for (let j = result; j > places; j--) {
        a *= j;
    }

    // Output the result to STDOUT
    console.log(a);
    process.STDOUT.write(a)

}

});
`

How can I use adb shell commands in detox tests?

`it('TC-30: WIFI', async () => {
    child.exec('adb shell cmd connectivity airplane-mode enable');
    await element(by.label('Violation №1')).tap();
    const errorMessage = 'no connection';
    waitFor(element(by.label(errorMessage))).toBeVisible();
});`

I tried to make smth like this but its not working. Child isnt exist.

So how can I use UI settings directly from e2e tests?

Also how can I import images after opening photo library?

toggle button has disapeared or wont move

I am following a tutorial to create a responsive watch website. I am currently working on the navbar, and the toggle button is not appearing where the exit button is supposed to be. When I reload the page, it shows up at the bottom left, and if I click the exit button, it disappears and doesn’t show up anymore. Please help.

I’m new at this and honestly confused! I even tried ChatGPT, but it didn’t work. The tutorial doesn’t seem different either.

Here’s my HTML code:

<!DOCTYPE html>
   <html lang="en">
   <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">

      <!--=============== FAVICON ===============-->
      <link rel="shortcut icon" href="assets/img/favicon.png" type="image/x-icon">

      <!--=============== REMIXICONS ===============-->
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/3.5.0/remixicon.css">

      <!--=============== SWIPER CSS ===============-->
      <link rel="stylesheet" href="">

      <!--=============== CSS ===============-->
      <link rel="stylesheet" href="assets/css/styles.css">

      <title>Responsive wacthes website - Bedimcode</title>
   </head>
   <body>
      <!--==================== HEADER ====================-->
      <header class="header" id="header">
        <nav class="nav container">
         <a href="#" class="nav__logo">WATCHES</a>

         <div class="nav__menu" id="nav-menu">
            <ul class="nav__list">
               <li class="nav__item">
                  <a href="#" class="nav__link">HOME</a>
               </li>

               <li class="nav__item">
                  <a href="#" class="nav__link">ABOUT</a>
               </li>

               <li class="nav__item">
                  <a href="#" class="nav__link">FEATURED</a>
               </li>

               <li class="nav__item">
                  <a href="#" class="nav__link">NEW</a>
               </li>
            </ul>

            <div class="nav__social">
               <a href="https://www.facebook.com/" target="_blank" class="nav__social-link">
                  <i class="ri-facebook-circle-line"></i>     
               </a>

               <a href="https://www.instagram.com/" target="_blank" class="nav__social-link">
                  <i class="ri-instagram-line"></i>
               </a>
               
               <a href="https://twitter.com/" target="_blank" class="nav__social-link">
                  <i class="ri-twitter-x-line"></i>
               </a>
            </div>

            <!-- close button -->

            <div class="nav__close" id="nav-close">
               <i class="ri-close-line"></i>
            </div>

            <!-- toggle button -->

            <div class="nav__toggle" id="nav-toggle">
               <i class="ri-menu-line"></i>
            </div>
         </div>
        </nav> 
      </header>

      <!--==================== MAIN ====================-->
      <main class="main">
         <!--==================== HOME ====================-->
         <section class="home">
            
         </section>
      </main>

      <!--=============== GSAP ===============-->
      <script src=""></script>

      <!--=============== SWIPER JS ===============-->
      <script src=""></script>

      <!--=============== MAIN JS ===============-->
      <script src="assets/js/main.js"></script>
   </body>
</html>

this is my css:

/*=============== GOOGLE FONTS ===============*/
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap");

/*=============== VARIABLES CSS ===============*/
:root {
  --header-height: 3.5rem;

  /*========== Colors ==========*/
  /*Color mode HSL(hue, saturation, lightness)*/
  --title-color: hsl(0, 0%, 100%);
  --text-color: hsl(0, 0%, 60%);
  --body-color: hsl(0, 0%, 0%);

  /*========== Font and typography ==========*/
  /*.5rem = 8px | 1rem = 16px ...*/
  --body-font: "Montserrat", sans-serif;
  --h1-font-size: 1.5rem;
  --h3-font-size: 1rem;
  --normal-font-size: .938rem;
  --small-font-size: .813rem;

  /*========== Font weight ==========*/
  --font-regular: 400;
  --font-semi-bold: 600;
  --font-bold: 700;

  /*========== z index ==========*/
  --z-tooltip: 10;
  --z-fixed: 100;
}

/*========== Responsive typography ==========*/
@media screen and (min-width: 1152px) {
  :root {
    --h1-font-size: 2.25rem;
    --h3-font-size: 1.25rem;
    --normal-font-size: 1rem;
    --small-font-size: .875rem;
  }
}

/*=============== BASE ===============*/
* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  font-family: var(--body-font);
  font-size: var(--normal-font-size);
  background-color: var(--body-color);
  color: var(--text-color);
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/*=============== REUSABLE CSS CLASSES ===============*/
.container {
  max-width: 1120px;
  margin-inline: 1.5rem;
}

.main {
  overflow: hidden;
}

/*=============== HEADER & NAV ===============*/
.header{
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  background-color: var(--body-color);
  border-bottom: 1px solid var(--text-color);
  z-index: var(--z-fixed);
}

.nav{
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo{
  color: var(--title-color);
  font-weight: var(--font-semi-bold);
  letter-spacing: 3px;
}

.nav__close{
  font-size: 1.5rem;
  color: var(--title-color);
  cursor: pointer;
} 

.nav__toggle{
  font-size: 1.5rem;
  color: var(--title-color);
  cursor: pointer;
}

/* Navigation for mobile devices */

@media screen and (max-width: 1023px){
  .nav__menu{
    position: fixed;
    top: -100%;
    left: 0;
    background-color: var(--body-color);
    border-bottom: 1px solid var(--text-color);
    width: 100%;
    padding-block: 4.5rem 3.5rem;
    transition: top .4s;
    
  }
}

.nav__list{
  display: flex;
  flex-direction: column;
  row-gap: 2rem;
  text-align: center;
}

.nav__link{
  color: var(--text-color);
  font-weight: var(--font-semi-bold);
  letter-spacing: 3px;
  transition: color .3s;
}

.nav__link:hover{
  color: var(--title-color);
}

.nav__social{
  display: flex;
  justify-content: center;
  column-gap: 1.5rem;
  margin-top: 3rem;
}

.nav__social-link{
  font-size: 1.5rem;
  color: var(--text-color);
  transition: color .4s;
}

.nav__social-link:hover{
  color: var(--title-color);
}

.nav__close{
  position: absolute;
  top: 1.15rem;
  right: 1.5rem;
}
/* Show menu */

.show-menu{
  top: 0;
}

this is my js:

/*=============== SHOW MENU ===============*/
const navMenu = document.getElementById('nav-menu'),
    navToggle = document.getElementById('nav-toggle'),
    navClose = document.getElementById('nav-close')

// MENU SHOW
// VALIDATE IF CONSTANT EXIST

if(navToggle){
    navToggle.addEventListener('click', () =>{
        navMenu.classList.add('show-menu')
    })
}

// MENU HIDDEN
// VALIDATE IF CONSTANT EXIST

if(navClose){
    navClose.addEventListener('click', () =>{
        navMenu.classList.remove('show-menu')
    })
}

and some pictures

desktop view

mobile view kinda

upon posting what it looks like i complete stop seeing anything no navbar even if i reloaded deleted or reopened the file so yeah.

thanks for reading and responding

AWS Javascript SDK to copy S3 objects more than 5 GB

I need to copy S3 objects which is more than 5 GB from one S3 bucket to another. I have successfully done it using boto3 but facing issue while doing it in JS.

s3 = boto3.resource('s3')
s3.meta.client.copy(copy_source,targetBucket,new_key)

The above code is working correctly and it copies object >5GB.

Now I need to implement same in JS.

const AWS = require('aws-sdk');    
const s3 = new AWS.S3();    
await s3.copyObject({Bucket,CopySource,Key})

I understand that the above code will only copy objects not more than 5GB and we will have to utilize multipart upload like done in boto3.

I even went through the aws documentation but could’nt find a way to do so in JS.

Failed to load resource: the server responded with a status of 500 (Internal Server Error) with Nextjs

I use Next.js and I’m just trying to add data to the server normally using the fetch method and thunk, but I get this error:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

I have attached pictures of the error to clarify further
consol
Sources

printed error

here addbookForm.jsx file:

import React, { useRef } from 'react'
import { useDispatch } from 'react-redux'
import { insertBook } from '@/app/redux/Features/bookSlice'

function addBooksForm() {

  const dispatch = useDispatch();
  //ref
  const title = useRef(null);
  const img = useRef(null);
  const descripition = useRef(null);
  const bookLinke = useRef(null);
  

  const handelSubmit =(e)=>{
    e.preventDefault()
    const data = {
      name: title.current.value,
      photo: img.current.value,
      des: descripition.current.value,
      link: bookLinke.current.value,
      
    };
    dispatch(insertBook(data))
    title.current.value = null;
    img.current.value = null;
    descripition.current.value = null;
    bookLinke.current.value = null;
    
  }

  return (
  
    <div className="w-full  px-4 bg-white ">
    <div className="max-w-[700px] mx-auto">
      <div className="w-full shadow-xl flex flex-col p-4 my-8 rounded-lg ">
        <h2 className="text-2xl font-bold text-center py-4">Insert Book</h2>
        <form onSubmit={handelSubmit}>
          <div className="mb-6">
            <label className="block mb-2 text-l font-medium text-gray-900">
              Title
            </label>
            <input
              type="text"
              className="block w-full p-4 mb-4 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 sm:text-md "
              ref={title}
              required
            ></input>
            <label className="block mb-2 text-l font-medium text-gray-900">
            Linke of image
          </label>
          <input
            type="url"
            className="block w-full p-4 mb-4 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 sm:text-md "
            ref={img}
            required 
          ></input>
            <label className="block mb-2 text-sm font-medium text-gray-900 ">
              Description
            </label>
            <textarea
              
              rows={4}
              className="block p-2.5 w-full text-sm mb-4 text-gray-900 bg-gray-50 rounded-lg border border-gray-300"
              
              ref={descripition}
              required
            ></textarea>
            <label className="block mb-2 text-l font-medium text-gray-900">
            Linke of book
          </label>
          <input
            type="url"
            className="block w-full p-4 mb-4 text-gray-900 border border-gray-300 rounded-lg bg-gray-50 sm:text-md "
            ref={bookLinke}
            required
          ></input>
            <button
              type="submit"
              className="text-white bg-[#BDA175] hover:bg-black disabled:bg-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2" 
            >
              Submit
            </button>
          </div>
        </form>
      </div>
    </div>
  </div>
      
  )
}

export default addBooksForm

here bookSlice.js file:

"use client";
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";


export const insertBook = createAsyncThunk(
  "book/insertBook",
  async (bookData, thunkAPI) => {
    const { rejectWithValue } = thunkAPI;

    try {
      const res = await fetch("http://localhost:3005/books", {
        method: "POST",
        body: JSON.stringify(bookData),
        headers: {
          "Content-type": "application/json; charset=UTF-8",
        },
      });
      const data = await res.json();
      return data;
    } catch (error) {
      return rejectWithValue(error.message);
    }
  }
);

const bookSlice = createSlice({
  name: "book",
  initialState: { books: [], isLoading: false, error: null },
  reducers: {},
  extraReducers: (builder) => {
   
   
      // INSERT BOOK
      builder.addCase(insertBook.pending, (state, action) => {
        state.isLoading = true;
        state.error = null;
      }),
      builder.addCase(insertBook.fulfilled, (state, action) => {
        state.isLoading = false;
        state.books.push(action.payload);
      }),
      builder.addCase(insertBook.rejected, (state, action) => {
        state.isLoading = false;
        state.error = action.payload;
      });
  },
});
export default bookSlice.reducer;

here Json server file :

{
  "books":[{
    "_id": "64027b8446d3263101d3a522",
    "name": "Medical Informatics and Bioimaging Using Artificial Intelligence",
    "photo": "https://media.springernature.com/w92/springer-static/cover/book/978-3-030-91103-4.jpg?as=webp",
    "des": "Aboul Ella Hassanien,   Roheet Bhatnagar,   Václav Snášel,   Mahmoud Yasin, Shams, Medical Informatics and Bioimaging Using Artificial Intelligence: Challenges, Issues, Innovations and Recent Developments. Studies in Computational Intelligence (SCI, volume 1005) 2022 ",
    "link": "https://link.springer.com/book/10.1007/978-3-030-91103-4"
    
},
{
    "_id": "64027bb846d3263101d3a526",
    "name": "Modeling, Control and Drug Development for COVID-19 Outbreak Prevention",
    "photo": "https://media.springernature.com/w92/springer-static/cover/book/978-3-030-72834-2.jpg?as=webp",
    "des": "Ahmad Taher Azar, Aboul Ella Hassanien Modeling, Control and Drug Development for COVID-19 Outbreak Prevention Studies in Systems, Decision and Control (SSDC, volume 366), 2022  ",
    "link": "https://link.springer.com/book/10.1007/978-3-030-72834-2"

},
{
    "_id": "64027bcb46d3263101d3a528",
    "name": "Modeling, Control and Drug Development for COVID-19 Outbreak Prevention",
    "photo": "https://media.springernature.com/w92/springer-static/cover/book/978-3-030-72834-2.jpg?as=webp",
    "des": "Ahmad Taher Azar, Aboul Ella Hassanien Modeling, Control and Drug Development for COVID-19 Outbreak Prevention Studies in Systems, Decision and Control (SSDC, volume 366), 2022  ",
    "link": "https://link.springer.com/book/10.1007/978-3-030-72834-2 "
  
},
{
    "_id": "64027bdb46d3263101d3a52c",
    "name": "Digital Twins for Digital Transformation: Innovation in Industry",
    "photo": "https://media.springernature.com/w92/springer-static/cover/book/978-3-030-96802-1.jpg?as=webp",
    "des": "Aboul Ella Hassanien,   Ashraf Darwish,  Vaclav Snasel, Digital Twins for Digital Transformation: Innovation in Industry Studies in Systems, Decision and Control (SSDC, volume 423), 2022  ",
    "link": "https://link.springer.com/book/10.1007/978-3-030-96802-1"
    
},
{
    "_id": "64027be746d3263101d3a530",
    "name": "Security Issues and Privacy Threats in Smart Ubiquitous Computing",
    "photo": "https://media.springernature.com/w92/springer-static/cover/book/978-981-33-4996-4.jpg?as=webp",
    "des": "Parikshit N. Mahalle, Gitanjali R. Shinde, Nilanjan Dey, Aboul Ella Hassanien, Security Issues and Privacy Threats in Smart Ubiquitous Computing, Part of the Studies in Systems, Decision and Control book series (SSDC, volume 341)",
    "link": "https://link.springer.com/book/10.1007/978-981-33-4996-4"
  
}]
}

How can I fix that error ? Just post data in Json server .

Javascript: Using Prompt input to change html text [closed]

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <title>Javascript Testbed</title>
</head>
<body>
    <h1>Javascript Testbed</h1>

    <h3 id="promptText">Answer Prompt to change this text!</h3>

    <script src="javascript.js"></script>

</body>
</html>
let promptNewText = prompt("Write anything");

console.log(promptNewText)

document.getElementById(promptText).innerHTML(promptNewText)

The task is to change the following HTML text:

<h3 id="promptText">Answer Prompt to change this text!</h3>

with whatever is being written in the prompt.

I have tried a few variations of this code:

let promptNewText = prompt("Write anything");

console.log(promptNewText)

document.getElementById(promptText).innerHTML(promptNewText)
let promptNewText = prompt("Write anything");

console.log(promptNewText)

document.getElementById("promptText").innerHTML("promptNewText")

How to make part of the scroll, horizontal in react?

I want to make part of the normal scroll, horizontal without any scrollbars or left/right handles. (shown below)

enter image description here

Also, I don’t want to use jquery or framer motion. As shown in the gif, the horizontal scroll is part of the normal scrollbar, it’s like they are all part of one scroll view.

Child Views ( Pressable, TouchableOpacity etc.) are not responding to touch events if wrapped inside a Custom Native Android View

I have 2 custom native android view’s ( the first custom view extends from RelativeLayout while the 2nd one extends from ReactViewGroup ) which wraps normal react-native components like TouchableOpacity, Pressable etc. I am passing onPress listeners to these but none of them are getting fired. I have tried overriding the onTouchEvent of my custom native android view but they are never called so I am thinking the touch event is consumed by one of the child views but still it fails to call the onPress listeners for the same.

Is there a way to effectively debug this ? A way for me to go down the touch event hierarchy and see who all gets the touch event ?

I have tried placing a breakpoint on the dispatchTouchEvent by overriding in the custom native android view and it gets called as well but I cant seem to effectively debug it due to a long chain of calls that it makes.

Im making a calendar that can make room reservations and show projects milestones

How can I put 2 events in the events so that it shows in the calendar the milestones and the reservations. Ive tried to put it like this:

events={milestones.map(milestone => {
                        return {
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        };
                    })/*, this.state.reservations*/}

By doing like this it only shows the milestones but if I put it like this:

events={/*milestones.map(milestone => {
                        return {
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        };
                    })*/ this.state.reservations}

It only shows the reservations. How can I put in a way that it shows both of them?

I tried to put it like this but it still only shows the first one:

events={milestones.map(milestone => {
                        return {
                            id: milestone.id,
                            title: milestone.description,
                            start: milestone.expectedDate
                        };
                    }) , this.state.reservations}

Expo: Set default development server

When I start my Expo server and run the app on emulator/simulator, I want to use localhostby default without opening the server selection screen of the Expo.

expo development server selection screen

Why do I need this?

I want to test a deeplink by pressing the link in Notes app while the app is closed. My app is getting stuck on splash screen when opened by deeplink.

I have looked at the Expo documents related to starting the server and running the app on local with a debug build. But I haven’t seen an option/configuration to skip the Expo server selections creen.

Change icon on button click

I have a video with a custom mute control button. I would like the icon to change on click. Here is the code I currently have:

<video id="myVideo" loop autoplay muted>
  <source src="https://md-testdomein.nl/partyz/wp-content/uploads/2023/12/WEBVERSIE_169_PartyZ_Brandfilm_V8.01.mp4">
</video>

<button id="mute-button" onclick="muteToggle();" type="button">
    <i id="mute-button-icon" class="fa fa-volume-up"></i>
</button>

<script>
function muteToggle() {

    let vid=document.getElementById("myVideo");
    
    let element = document.getElementById("mute-button-icon");

    if(vid.muted){
        vid.muted = false;
        element.classList.toggle("fa-volume-up");
    } else {
        vid.muted = true;
        element.classList.toggle("fa-volume-off");
    }
}
</script>

You can preview the button on site here: https://md-testdomein.nl/partyz/

The button icon does change but the first time I click it the icon disappears, the second time the icon ‘fa-volume-off’ shows up and the third time the icon ‘fa-volume-up’ shows up.

The icon ‘fa-volume-up’ should be shown when the audio is off and the icon ‘fa-volume-off’ should show when the audio is on.

This should be pretty easy but I can’t figure it out. Can someone help me fix it.