DEV Community

Discussion on: UI with one input field that accepts only numbers in Javascript

Collapse
 
nileshrawatau45 profile image
Nilesh Rawat

so how to do it can you answer?

here is my code

function fun(){
var a = document.getElementById("numvalid")

if(a < 1){
   return(document.getElementById("msg").innerHTML= "enter the positive value") 


}
else{
    return 
}
Enter fullscreen mode Exit fullscreen mode

}

console.log(fun())