Reputation: 1320
I'm building a finance calculator with jQuery which is working well. The calculator uses jQuery sliders. I have the following function which is called when a slider is activated.
However I need to replicate this so the same actions are called on page load, could anyone suggest how I might achieve this?
jQuery(document).ready(function($) {
$("#slider-deposit").slider({
value: 100,
min: <?php echo json_encode($minDeposit); ?>,
max: <?php echo json_encode($maxDeposit); ?>,
step: 1,
slide: function(event, ui) {
$("#amount-deposit").val(Number(ui.value).toFixed(2));
totalPayableFunc();
monthlyPaymentsFunc();
}
});
$("#amount-deposit").val("" + $("#slider-deposit").slider("value"));
});
Upvotes: 0
Views: 67
Reputation: 5109
Is it this?
jQuery(document).ready(function($) {
$("#slider-deposit").slider({
value: 100,
min: <?php echo json_encode($minDeposit); ?>,
max: <?php echo json_encode($maxDeposit); ?>,
step: 1,
slide: function(event, ui) {
$("#amount-deposit").val(Number(ui.value).toFixed(2));
totalPayableFunc();
monthlyPaymentsFunc();
}
});
$("#amount-deposit").val("" + $("#slider-deposit").slider("value"));
totalPayableFunc();
monthlyPaymentsFunc();
});
Upvotes: 1