ต้องเอาใส่ไว้ใน event open ของ dialog ครับ
//ตรวจจับ event "Change" = เมื่อเปลี่ยนค่าของ radio box ตอนไหนค่าใน text box ก็จะเปลี่ยนตามที่เขียนไว้อันเดิมใส่ไว้ใน button "Save" ตรงนั้นจะทำงานเมื่อกดปุ่ม "Save"
//กดปุ่ม "Save" > ตรวจจับ event "Change" >ปิด dialogประมาณนี้ครับ
...
buttons: {
"Save": function() {
$( this ).dialog( "close" );
},
"Cancel": function() {
$( this ).dialog( "close" );
}
},
open: function() {
$('.shirt_type').on('change', function(){
if(this.value == 1){
$('#sh_type').val("Hello");
}
if(this.value == 2)
{
$('#sh_type').val("World");
}
if(this.value == 3)
{
$('#sh_type').val("Yes");
}
if(this.value == 4)
{
$('#sh_type').val("Wow");
}
});
},
close: function() {
$('.shirt_type').val("");
}
...