Input and onchange


#1

Hey,
I’m trying to use :
<input id="quantity" type="range" min="0.5" max="4" value="1" step="0.5" oninput="showVal(this.value)" onchange="showVal(this.value)"/>

with a showVal :
showVal($value) { console.log($value); }

But in my app i got Uncaught ReferenceError: showVal is not defined
By the way, the js file is ok, others functions works, and i got this error only if i use my function in the input.
I would like to not use ion-range (CSS problems)

What am I doing wrong?

Thank you already


#2

Try using (change) instead of onchange. In your example: (change)=showVal(quantity) [(ngModel)]="quantity"


#3

wow you save my time
thank you


#4

Thanks a lot’s Ricardo Moran of programming.

pd. Search “Ricardo Moran Peru” in Google :wink: