Not sure if it's actually iterating once, but only one dialog is being generated. the jquery loop is aimed at a hidden input for each PHP loop iteration which counts up from one; There's two 'roomID' total.
Using alert gives me two, but it is not assigning the dialog with jquery, which in return gives me the first one. Why is this happening?
Is there a better method of doing this:
$('input#roomID').each(function() {
var roomID = $('input#roomID').val();
alert($(this).val());
$( 'div.edit-dialog-'+roomID ).dialog({
autoOpen: false,
height: 500,
width: 550,
modal: true,
position:['middle','middle'],
draggable: true,
//resizable: true,
buttons: {
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
$( 'a.room-edit-'+roomID).click(function() {
$( 'div.edit-dialog-'+roomID ).dialog( "open" );
});
});
I'm somewhat new to Jquery.