我有一个剑道开关按钮,如下所示:
<div class="col-md-2 form-group">
<input id="euro-switch" aria-label="euro Switch" />
</div>
这是jQuery的:
$("#euro-switch").kendoMobileSwitch({
onLabel: "€",
offLabel: "%",
change: function (e) {
$('kendoNumericTextBox').value
}
});
我有一个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>
现在我想欧元和百分之之间进行切换,这样您将看到欧元符号(€)或%符号在numerictextbox。
我怎样才能做到这一点?
谢谢
奥凯,我现在有这样的:
$("#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
});
这是我的剑道numerictextbox:
@(Html.Kendo().NumericTextBox()
.Name("SignalThreshold")
.Value(0)
.Step(10)
.Min(0)
.Events(e => e.Change("FilterThresholdChange"))
.Format("'€' ##.00")
)
但是,这是行不通的。