Jump to content

Recommended Posts

  • 2 weeks later...

Hi,

 

Thanks for that. Is there a using that by calculating 2 figures with two sliders together? I have the following code eg:

 

$( "#slider-range-max" ).slider({
		range: "max",
		min: 0,
		max: 90000,
		value: 45000,
		slide: function( event, ui ) {
			$( "#amount" ).val( ui.value );
			var aaa = $("#amount").val();
                                var bbb = $("#amountb").val();
                                var ccc = $("#amountc").val();
                                var ddd = $("#amountd").val();
                                var eee = $("#amounte").val();
                               var fff = $("#amountf").val();
                               $("#total").val(+aaa + +bbb + +ccc + +ddd + +eee + +fff);
		}
	});
               
                $( "#slider-range-max-dif" ).slider({
		range: "max",
		min: 0,
		max: 30,
		value: 15,
		slide: function( event, ui ) {
			$( "#difference" ).val( ui.value );
			var adif = $("#difference").val();
                                var bdif = $("#differenceb").val();
                                var cdif = $("#differencec").val();
                                var ddif = $("#differenced").val();
                                var edif = $("#differencee").val();
                                var fdif = $("#differencef").val();
                                $("#total_dif").val(+adif + +bdif + +cdif + +ddif + +edif + +fdif);
		}
	});

 

However, i can't seem to get something like this calculation to work:

 

$("#result").val(+aaa * (+adif / 100));

 

and

 

$( "#result" ).val( $( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) ) * ( $( "#difference" ).val( $( "#slider-range-max-dif" ).slider( "value" ) ) / 100 ) );

 

With either of the codes above i'm trying to get the result from one row by dividing the adif by 100 and multiplying it by aaa. The result i seem to be getting is NaN. Whats the correct way to do this. I'm no javascript/jquery expert.

Link to comment
https://forums.phpfreaks.com/topic/267726-any-cash-slide-bar/#findComment-1377042
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.