Skip to content

Commit 48afc0d

Browse files
authored
Get input value as a number
1 parent 5b5e313 commit 48afc0d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
|32 | [The void operator](#The-void-operator)|
3939
|33 | [replaceAll](#replaceAll)|
4040
|34 | [Required Function Params](#Required-Function-Params)|
41+
|35 | [Get input value as a number](#Get-input-value-as-a-number)|
42+
4143

4244

4345
**[⬆ Back to Top](#table-of-contents)**
@@ -737,4 +739,18 @@ console.log(getPage());
737739
738740
739741
742+
**[⬆ Back to Top](#table-of-contents)**
743+
### Get input value as a number
744+
745+
```javascript
746+
747+
<input type="number" id="JSsnippets" onkeyup="checkMyType(event)" />
748+
749+
function checkMyType(event){
750+
751+
console.log(typeof event.target.value) // string
752+
console.log(typeof event.target.valueAsNumber ) // number
753+
754+
}
740755
756+
```

0 commit comments

Comments
 (0)