test with these modifications:
var opciones = {
title: 'Add comment',
modal: true,
buttons: {
OK: function() {
$(this).dialog('close');
x = $('#obserText').val();
$('#obser' + id).val(x);
}
}
};
$('.addObs').click(function(){
var id = this.attr("id");
var x = id.split('_');
var y = '[' + x[0] + '][' + x[1] + ']';
// If the hidden file exists, show its value
// It should show the dialog again to allow edit the comment, but I'll leave it until later
if ($('#obser_' + id).length>0)
{
alert($('#obser_' + id).val());
}
else //If not...
{
//Create it
$(this).parent().prepend("<input type=\"hidden\" id=\"obser_" + id + "\" />");
//Show the dialog
if ($("#obserText").length>0)
$("#obserText").remove();
var xdialog = $("<div></div>").html("<textarea id=\"obserText\"></textarea>");
xdialog.dialog(opciones);
}
}
andres descalzo
2009-10-15 20:01:19