Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery dialog : Hide the button

I am using Jquery's dialog() method to create dialog. I am creating buttons on the dialog while creating the dialog, using

      $("#divName").dialog({
            buttons:
            {
            "Cancel":{

I have one event on which I need to hide the button,but don't know which attributes to use. Please tell me the attributes to hide button. Thanks in advance.

like image 817
Swap905 Avatar asked Jul 16 '12 12:07

Swap905


People also ask

How do I hide a button in modal popup?

The . modal(“hide”) method hides the modal on button click.

How to remove close Icon from jQuery Dialog?

HTML. Here, we will see how to remove the close button on the jQuery UI dialog using CSS. Approach: By setting the display property of the ui-dialog-titlebar-close class element to none.


2 Answers

If you're trying to hide the "cancel" button, try this. 

$('.ui-dialog-buttonpane button:contains("cancel")').button().hide();
like image 200
bang Avatar answered Oct 08 '22 21:10

bang


When you create the dialog, you describe the buttons and the attributes of the buttons, so add an "id" attribute to the button:

buttons: [ { text: "Save", id: "btnId", click: function() { ... } } ]

You can then use the id as a jquery filter for the hide() and show() methods:

$("#btnId").hide()...

like image 36
Beau Avatar answered Oct 08 '22 20:10

Beau