Project encountered a demand:
when collecting area code, area code or digital input region name, display blur option, and the contents of the input for verification.
Using jQuery ui plug-solving, jQuery ui Download .
We encountered the following problem: when the trigger select event, call bootStrap check function does not take effect.
code show as below:
$(#areaCode).autocomplete({
source:districtCode,
minLength:2,
select:function(event,ui){
TaskDetail.validateAreaCode();
}
})
摸索过程中,发现调用之前加入alert就会生效。
$(#areaCode).autocomplete({
source:districtCode,
minLength:2,
select:function(event,ui){
alert(ui.item.value);
TaskDetail.validateAreaCode();
}
})
Search for something online, this article gives inspiration: solve js code added alert () on the successful execution, without the problem is not right .
The final code to read:
$(#areaCode).autocomplete({
source:districtCode,
minLength:2,
select:function(event,ui){
setTimeout(TaskDetail.validateAreaCode,100);
}
})
To solve the verification problem.