i want the all arrays value checked to the value in the number field in javascript -
i want arrays value checked value in number field in javascript. how can ?
demop = document.getelementbyid("demo"); var numbers = [4, 9, 16, 25]; function myfunction() { if( $("#hsc").value == numbers) { demop.style.display = 'none';} else { demop.style.display = 'block'; } }
var demop = document.getelementbyid("demo"); var numbers = [4, 9, 16, 25]; function myfunction(data) { //console.log(typeof data) if (numbers.indexof(number(data))>=0) { demop.style.display = 'none'; } else { demop.style.display = 'block'; } }
<input type="number" onchange="myfunction(this.value)" id="hsc">try <p id="demo" style="display:none;">wrong</p>
numbers.indexof
whether value present or not.
Comments
Post a Comment