Suddenly on my website, clickable buttons which makes the slider go to different values stopped working because of this error: Uncaught TypeError: $(...).slider is not a function
The main slider code works and an error does not popup saying slider is not a function for this: `
$( "#test" ).slider({
range: "max",
min: minCoins,
max: 100000,
value: 2,
step: 10000,
slide: function( event, ui ) {
var slidVal = ui.value;
if ( slidVal%10000 == 0 ){ // this condition because for each slide we are increasing the value by 1000
slidValCm = slidVal;
$("#noofCoins").html(numberWithCommas(slidValCm));
document.getElementById('coinsBought').value = ($('#noofCoins').text());
$('#quantity').val(); //just empty input for security purpose
}
for ( i = 0;i <= slidVal;i++ )
{
if ( i%10000 == 0 && i != 0){
quant = quant+1;
exactCoint = exactCoint+10000;
costCoin = costCoin+costPair;
costCoinFi = (costCoin*1).toFixed(2);
$("#quant").html(quant);
$('#quantity').val(parseInt(quant));
$("#price-preview").html("<span class='money'>£"+costCoinFi+"</span>");
Currency.convertAll(defaultCurrency, Currency.currentCurrency);
}
if ( i == 0){
$("#quant").html(0);
$("#price-preview").html("<span class='money'>£"+costCoinFi+"</span>");
Currency.convertAll(defaultCurrency, Currency.currentCurrency);
}
}
costCoin = 0;
quant = 0;
}
});`
However, for the individual quick value buttons it doesn't update the slider position because it says slider is not a function. Example this is one of the event handlers for one of the buttons.
$("#20k").on('click', function(){
var coinNum = 20000;
var totlCost = getCost(coinNum);
var totquan = (coinNum/rngCoins/10);
$("#quant").html(totquan);
$('#quantity').val(parseInt(totquan));
$("#price-preview").html("<span class='money'>£"+totlCost+"</span>");
$("#noofCoins").html("20,000");
$("#test").slider('value', 20000);
document.getElementById('coinsBought').value = ($('#noofCoins').text());
Currency.convertAll(defaultCurrency, Currency.currentCurrency);
});
This - $("#test").slider('value', 20000);
- would be the problem of issue. Why is this? Thanks