How to show jQueryUI Dialog Buttons after script has been run
I have a jQueryUI Dialog popup, which executes our telnet commands to a device. I don't want the windo开发者_如何学编程w to close accidentally while the commands are being sent.
Is there a way to only show the close button when my telnet script has been executed?
Tomorrow at work i can include my code as well.
Much thanks
Yes, sure you can definitely do it.
Don't show the close button when the pop-up is initially opened, instead leave it as "display:none;
" using the CSS.
Now after the telnet command has been executed, make it return some value to that jQuery function & then use that value to change the CSS of that close button to "display:block;
".
Hope it helps.
You could do something like:
On initially loading the Dialog:
$("#telnetdlg").dialog({ buttons: [] });
And then when the telnet command has completed:
$("#telnetdlg").dialog({ buttons : [ { text:"Close", click : function() { $(this).dialog("close"); } } ] };
精彩评论