if give more than 10 characters then button should be disabled but when we give <10 character’s button should be enabled not working
import React, { useState } from "react";
export default function DropDown() {
let [disable,setDisable]=useState(false)
function check(){
let inp=document.querySelector('input');
let btn=document.querySelector('button');
if(inp.value.length>10){
btn.disable=true
setDisable(true)
}else{
btn.disable=false;
setDisable(false)
}
}
return (
<>
<input disabled={setDisable} onKeyUp={check}/>
<button>click</button>
</>
);
}