van*_*con 2 jquery drag-and-drop input
我正在使用这个jQuery代码
$('input').bind('change mouseup', ... )
Run Code Online (Sandbox Code Playgroud)
检测用户是否将文本拖到我的输入中并更改其值.但这似乎不起作用.为什么它不起作用,我怎么能让它工作?
小智 7
var inputField = $("input");
var oldValue = inputField.text();
inputField.bind("drop", function() {
//when the drop happens the input value will not be updated yet
//use a timeout to allow the input value to change.
setTimeout($.proxy(function() {
if (this.value !== oldValue) {
$(this).trigger('change');
}
}, this), 0);
});
$("input").bind("change", function() {
oldValue = this.value;
});
Run Code Online (Sandbox Code Playgroud)
运行代码:http: //jsfiddle.net/paulwesterberg/FJuvz/5/
| 归档时间: |
|
| 查看次数: |
5066 次 |
| 最近记录: |