0

我正在使用 JSignature 并试图弄清楚如何在签名获得焦点和失去焦点时触发事件。

绑定到更改事件有效,但焦点、鼠标按下等不会触发。

如果有人知道如何执行此操作,将不胜感激

$('.jsig').jSignature({format:"image/jpeg"}) // inits the jSignature widget.
$(".jsig").jSignature.bind('mousedown', function(e) {
    alert("mousedown");
});
$(".jsig").jSignature.bind('focus', function(e) {
    alert("focus");
});

var j=$(".jsig").jSignature;

$(".jsig").bind('change', function(e) {
    var d = $(e.target).jSignature("getData", "native");
    document.getElementById('st').value=d.length+'.'+d[0].x.length;
});
4

1 回答 1

0

如果它对其他人有帮助,答案似乎是将 onmouseenter 添加到 div JSignature 附加到

<div id="jsig" class="jsig" onmouseenter="dosomething();"></div>

<script>
function dosomething(){
    alert("Here");
}

然后可以使用bind change来查看是否有签名或者onmouseleave。

于 2017-03-09T09:41:41.240 回答