我的代码中有一个onChange和onClick事件。我希望onChange需要执行,然后才会执行onClick事件。
如果我在文本框中键入内容并单击按钮,则显示第1个警告消息,下一个也显示确认消息。看起来它是因为DWR处理速度慢。有人有解决方案。
function ChangingEvent()
{
//Here I have a dwr function to fetch data from DB and checks for Duplicate.
if(Duplicate)
confirm('Are you sure want to allow Duplicate');
}
function ClickEvent()
{
//Here Some validation part and submitting the form
if(field1.value=="")
alert('field 1 is null');
form.submit();
}
<input type="text" onChange=ChangingEvent()>
<input type="button" onClick=ClickEvent()>