You can find a solution about this in many posts ( Post 1 , Post2 ), but their solution does not work for me.
Here is the regular jquery dialog box written by me.
$("#dialog").dialog({ autoOpen:false, buttons:{ "ok":function(){ $(this).dialog("close"); return true; }, "cancel":function(){ $(this).dialog("close"); return false; } } });
I will open a dialog box with the code:
var returnVal=$("#dialog").dialog("open");
I need to return false if the user clicks βcancelβ and returns true if the user clicks βokβ.
var returnVal=$("#dialog").dialog("open");
I need returnVal to return boolean value (true / false), but it returns a javascript object .
source share