i want to show a message box when the ajax autocomplete value is selected to the certain textfield. i'm using jquery-confirm js library for this. here is my code.
select: function( event, ui ) {
console.log( ui.item.value );
nic= ui.item.value;
$("#msgbox").open();
return false;
}
.
$("#msgbox").confirm({
title: 'Entry Found',
content: 'msg',
lazyOpen:true,
buttons: {
confirm: function () {
$.alert('Confirmed!');
},
cancel: function () {
$.alert('Canceled!');
},
ps: i'm so new to js and these jquery stuffs.:)
okay i found the problem, select
should be outside of the jquery source
,here is the complete code;
$("#nic").autocomplete({
minLength:5,
source : function(request, response) {
$.ajax({
url: "ajaxautocomplete.html",
type: "Post",
data:JSON.stringify({"nic": request.term}),
contentType: "application/json",
dataType: "json",
success : function(data) {
response($.map(data.patient, function (patient) {
return{
label: patient.nic,
id: patient.id,
}
}))
}
});
},
select: function( event, ui ) {
//msg confirm box
return true
}
});
and the dialog box was not working, i used jquery-confirm box.