Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

checkbox multiple select

 const [multipleName, setMultipleName] = useState<string[]>([]);
 const [ownerid, setOwnerId] = useState(" ");  
const storeMultiName = (name: any, ownerid: any) => {
    setOwnerId(ownerid);
    let statusExist = false;
    multipleName?.find((val) => {
      if (val === name) {
        statusExist = true;
      }
    });
    if (statusExist) {
      const a = [...multipleName];
      const b = a.filter((val) => val !== name);
      setMultipleName(b);
    } else {
      const a = [...multipleName];
      a.push(name);
      setMultipleName(a);
    }
  };
Source by html5-tutorial.net #
 
PREVIOUS NEXT
Tagged: #checkbox #multiple #select
ADD COMMENT
Topic
Name
6+2 =