Reputation: 876
I work With Jquery and I have Dialog with two buttons [ OK, Cancel ]
my code is
$("#test").dialog({
modal: true,
minHeight: 600,
minWidth: 550,
buttons: {
OK: function() {
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
Sometimes I need to hide OK
button (only view Permission)
Can anybody help me?
Upvotes: 1
Views: 2558
Reputation: 35
SUGGESTIONS In buttons section you can find 2 button -- one is Ok , second one is Cancel ... You can not remove ok portion depending upon your condition / requierement.
Like if not-logged in you can load a different modal ... If logged in you can load another dialog....
SUGGESTIONS In buttons section you can find 2 button -- one is Ok , second one is Cancel ... You can not remove ok portion depending upon your condition / requierement.
Like if not-logged in you can load a different modal ... If logged in you can load another dialog....
var checking = '<?php if($UserId == "")echo '0'else echo 1; ?>';
if(checking == 1){
// load a dialog
}else{
// load a different dialog
}
Upvotes: 0
Reputation: 7916
Use a selector to identify the button and call $(selector).hide()
For example this should work with jquery ui
$('.ui-button:contains("Ok")').hide()
Upvotes: 0
Reputation: 10378
$("#test").dialog({
modal: true,
minHeight: 600,
minWidth: 550,
buttons: [{
text: "Ok",
id:"okid" ,//by this id set now you can do all operation base on this id
click: function () {
$(this).dialog("close");
}
},
{
text: "Cancel",
click: function () {
$(this).dialog("close");
}
}]
});
for hide ok button now
$("#okid").hide();
Upvotes: 1