Multiple oninput Events |
Multiple oninput Events |
Terminator |
Sep 19 2016, 04:15 PM
Post
#1
|
Advanced Member Group: Members Posts: 218 Joined: 19-March 15 Member No.: 22,398 |
I am making a Password Generator, is it ok to put oninput like I did below?
I have it set to run a function to generate the password, as well as change the display number for the slider when you move the slider. CODE <input type="range" id="num" oninput="GeneratePassword(); numOutputID.value=num.value" min="8" max="50" step="1" value="12"> <output id="numOutputID">12</output> This is the first time I have ever had a reason 2 put more than 1 thing inside of oninput, I can just separate with a semicolon right? I did not get any HTML Validator or Chrome Debugging JavaScript errors. This post has been edited by Terminator: Sep 19 2016, 04:16 PM |
Christian J |
Sep 19 2016, 04:27 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Yes, a semicolon works fine.
But why not use this.value, instead of num.value? Also it seems oninput doesn't work on range sliders in IE11: https://www.impressivewebs.com/onchange-vs-...-range-sliders/ but I haven't tested. |
Terminator |
Sep 19 2016, 04:36 PM
Post
#3
|
Advanced Member Group: Members Posts: 218 Joined: 19-March 15 Member No.: 22,398 |
I just changed it to this.value.
But I noticed its hard to do the slider in FireFox when I have both of these under oninput. It doesn't slide anymore when you hold it with the mouse in FF, you have to click it to change the slider. Chrome and Edge work fine though but it looks like Firefox does not like this: CODE oninput="GeneratePassword(); numOutputID.value=this.value" I guess I will have to move one of these to something that is very similar to oninput. This post has been edited by Terminator: Sep 19 2016, 04:37 PM |
Christian J |
Sep 19 2016, 07:33 PM
Post
#4
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
|
Terminator |
Sep 19 2016, 11:00 PM
Post
#5
|
Advanced Member Group: Members Posts: 218 Joined: 19-March 15 Member No.: 22,398 |
|
Lo-Fi Version | Time is now: 24th April 2024 - 06:34 AM |