【发布时间】:2016-06-27 18:59:21
【问题描述】:
我通过单击按钮将地址图像文件设置为文本框,这可以正常工作。
我需要一个侦听器来从文本框中获取值并显示警报。我不需要使用更改事件我不使用函数插入键盘值
$("#add").click(function(){
$("input").val('http://localhost/afa/uploads/source/error-img.png');
});
插入地址文件后,我会显示带有内容值输入的警报
var val = $("#fieldID4").val();
files2.push({src:val});
updateList2(files2.length-1);
function updateList2(n) {
var e = thumb.clone();
e.find('img').attr('src',files2[n].src);
e.find('button').click(removeFromList).data('n',n);
gallery.append(e);
function removeFromList() {
files2[$(this).data('n')] = null;
$(this).parent().remove();
}
}
【问题讨论】:
-
你试过“oninput”事件吗?这是您可以阅读的链接:developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/…
-
这项工作是用键盘实时输入的
-
无法通过程序识别更新
-
请显示完整的代码上下文。看起来您在另一个函数中定义了 2 个函数,并且不清楚您曾经在哪里调用这些函数
标签: javascript jquery html css