I have a kendo switch button, like this:
<div class="col-md-2 form-group">
<input id="euro-switch" aria-label="euro Switch" />
</div>
and this is the jquery:
$("#euro-switch").kendoMobileSwitch({
onLabel: "€",
offLabel: "%",
change: function (e) {
$('kendoNumericTextBox').value
}
});
and I have a numerictextbox:
<div class="col-md-2 form-group">
@(Html.Kendo().NumericTextBox()
.Name("SignalThreshold")
.Value(0)
.Step(10)
.Min(0)
.Events(e => e.Change("FilterThresholdChange"))
.Format("'€' ##.00")
)
</div>
Now I want to toggle between euro and percent so that you will see euro sign (€) or % sign in the numerictextbox.
How can I do that?
Thank you
oke,
I have it now like this:
$("#euro-switch").kendoMobileSwitch({
onLabel: "€",
offLabel: "%",
change: function (e) {
var label = e.sender.value() ? e.sender.options.onLabel : e.sender.options.offLabel.toString();
var inpbox = $('#SignalThreshold').data("kendoNumericTextBox");
console.log(inpbox)
inpbox.setOptions(
{
format: "" + label + "\ #",
decimals: 3
});
inpbox.value(inpbox.value());
}
});
$("#SignalThreshold").kendoNumericTextBox({
format: "\%\ #",
decimals: 3,
value: 1
});
and this is my kendo numerictextbox:
@(Html.Kendo().NumericTextBox()
.Name("SignalThreshold")
.Value(0)
.Step(10)
.Min(0)
.Events(e => e.Change("FilterThresholdChange"))
.Format("'€' ##.00")
)
But this doesn't work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…