jQuery ui autocomplete inside dialog
I have this code:
$.ajax({
url: '/products/edit',
type: 'post',
data: {id: id},
success: function( data ) {
$( '#divDialog' ).html( data );
$( '#divDialog' ).dialog({
autoOpen: false,
height: 300,
width: 400,
modal: true,
resizable: false,
title: 'Edit Product',
closeOnEscape: false,
open: function() {
$( this ).parent().css( 'overflow', 'visible' );
$$.utils.forms.resize();
}
})
.find( 'button#cancelButton' ).click( function() {
var $form = $(this).parents( '.ui-dialog-content' );
$form.find( 'form' )[0].reset();
$form.dialog( 'close' );;
$form.dialog( 'destroy' );;
})
.end().find( 'button#saveButton' ).click( function() {
var $form = $(this).parents( '.ui-dialog-content' );
$form.validate({
submitHandler: function( form ) {
$.ajax({
url: '/products/edit',
type: 'post',
data: form.serialize(),
success: function( data ) {
$.jGrowl( data );
$form.dialog( 'close' );;
}
});
}
});
});
// show dialog
$( '#divDialog' ).dialog( 'open' );
}
});
So, I append a form to my div $('#divDialog'). My question is how to use
jQuery autocomplete to any input of my form?
No comments:
Post a Comment