Summer Sale! All accounts are 50% off this week.

yanes6514's avatar

Problem with v-model on input (read-only)

I find a small problem, and that is that I am using a function of jquery of the range-sliders, and the return of their fields is in an input (read-only), with which I need to extract their information to give it to Vue. You can not apply v-model to the read-only fields. How could I solve this?

JQUERY:

$( function() { $( "#slider-range-mileage" ).slider({ range: "min", value: 700, min: 1, max: 700, slide: function( event, ui ) { $( "#amount-mileage" ).val( ui.value + "k" ); } }); $( "#amount-mileage" ).val( $( "#slider-range-mileage" ).slider( "value" ) + "k"); } );

HTML:

       <input class=" pl-3 input-range text-yellow" type="text" id="amount-mileage" v-model="rangeMileage">

Vue: var vm4 = new Vue({ el: '#inventory', data: { rangeMileage: ' ' }

0 likes
3 replies
robrogers3's avatar

That's right it'. And what's the point. It's read only so it's not reactive.

What are you trying to do. And why jquery?

yanes6514's avatar

Jquery because I also use 2 ranges in a slider and html does not provide that, that's why I use Jquery-UI, and I need the information to be able to filter the products with respect to that field.

Please or to participate in this conversation.