How do i assign an an id to a jquery dialog button. I tried the following but it's not working
buttons: { Ok: function() { id="xyz", ...
This code from official site worked for me:
$('#dialog').dialog({ // properties ... buttons: [{ id:"btn-accept", text: "Accept", click: function() { $(this).dialog("close"); } }, { id:"btn-cancel", text: "Cancel", click: function() { $(this).dialog("close"); } }] });
The following (seemingly undocumented) works for me with jQuery 1.8.9:
$("#dlg").dialog({ buttons : { "MyButton" : { text: "My Button", id: "my-button-id", click: function(){ alert("here"); } } } });
The button can be addressed via $("#my-button-id")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With