how to apply js on specific place? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to apply js on specific place?

how to get the input from the textbox and the apply some javascript on it like if get a number from user return the result odd or even??? how to do this ??

4th Oct 2016, 2:09 PM
rupali magar
rupali magar - avatar
1 Answer
+ 1
first you use document.getElementById("yourTextboxID").value to get the value of the textbox, after that you you use modulo to check if the number is even or not function isOdd(num) { return num % 2;}
1st Mar 2017, 9:32 AM
RJP
RJP - avatar