assign id to jquery dialog button

后端 未结 5 1344
小蘑菇
小蘑菇 2021-01-30 10:49

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\",
...
5条回答
  •  不要未来只要你来
    2021-01-30 11:47

    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")

提交回复
热议问题