The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Multiple oninput Events
Terminator
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 19 2016, 04:27 PM
Post #2


.
********

Group: WDG Moderators
Posts: 7,530
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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Terminator
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Sep 19 2016, 07:33 PM
Post #4


.
********

Group: WDG Moderators
Posts: 7,530
Joined: 10-August 06
Member No.: 7



QUOTE(Terminator @ Sep 19 2016, 11:36 PM) *

It doesn't slide anymore when you hold it with the mouse in FF, you have to click it to change the slider.

That doesn't happen to my FF. Is it the function GeneratePassword() that causes that? Maybe onchange could be used for that instead.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Terminator
post Sep 19 2016, 11:00 PM
Post #5


Advanced Member
****

Group: Members
Posts: 218
Joined: 19-March 15
Member No.: 22,398



QUOTE(Christian J @ Sep 19 2016, 07:33 PM) *

That doesn't happen to my FF. Is it the function GeneratePassword() that causes that? Maybe onchange could be used for that instead.


Great suggestion, moving GeneratePassword() to onchange fixed the FF issue with the Slider.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2017 - 12:26 AM