javascript - if else can't get the right value to return -
i using sliding scale value , homecoming input box.
and checking else if status , function homecoming value first time output right ui.value = 10 , 2 time display sliding scale value
how check status ?
$("#sliders #slider-range-min").slider({ range: "min", value: 0, min: 0, max: 5500, slide: function(event, ui) { if (ui.value >= '1' && ui.value <= '1000' ) { ui.value = 10; } else if (ui.value >= '10001' && ui.value <= '24999' ) { ui.value = 25; //console.log(ui.value); } else if (ui.value >= '25000' && ui.value <= '54999' ) { ui.value = 50; } else if (ui.value >= '55000') { ui.value = 100; } console.log(ui.value); homecoming $("#sliders #amount3").val("$" + ui.value); } });
here got solution...
use next code
$("#sliders #slider-range-min").slider({ range: "min", value: 0, min: 0, max: 5500, slide: function(event, ui) { if (ui.value >= '1' && ui.value <= '1000' ) { ui.value = 10; } //else if (ui.value >= '10001' && ui.value <= '24999' ) { else if (ui.value >= '1001' && ui.value <= '2499' ) { // ui.value = 25; //console.log(ui.value); } //else if (ui.value >= '25000' && ui.value <= '54999' ) { else if (ui.value >= '2500' && ui.value <= '5499' ) { ui.value = 50; } //else if (ui.value >= '55000') { else if (ui.value >= '5500') { ui.value = 100; } console.log(ui.value); homecoming $("#sliders #amount3").val("$" + ui.value); } });
try fiddle fiddle
hope helps.........
javascript jquery if-statement
No comments:
Post a Comment