可以使用自定义 html 属性将变量传递给 jquery 事件
<input type="text" id="custominput" data-ajax-id="1">
$("#custominput").on("click", function() {
alert($(this).data("ajax-id"));
}
我尝试对微调器使用相同的方法,但这不起作用。我想通过 html 自定义属性设置 max
<input type="text" id="spinnercount" class="form-control ui-spinner-input" name="groupcount" value="10" data-ajax-max="10" role="spinbutton">
$("#spinnercount").spinner({
max: $(this).data("ajax-max")
})
有谁知道如何做到这一点 ?
谢谢