how document.getelementbyclassname("but") I'm not able to modify the style inside the function. when i try to run the code i get this error enter image description here
When you use getElementsByClassName you are getting an array of elements. To fix your error, make sure to select the element you need, e.g.:
inputstxt[0].style.border = ..
Or if you want to apply the new styles to all:
for(let i = 0; i < inputstxt.length; i++) {
inputstxt[i].style.border = ..
}
cannot set properties of undefined means that you are trying to read the style of an Array instead of an element. So you would need to document.getElementsByClassName("but")[i].style //i is any index to get/set the style.