Set jQuery UI dialog button id?

后端 未结 3 1389
深忆病人
深忆病人 2021-01-01 13:05

Is it possible to set the ID for the buttons in a jQuery UI dialog, so that I can refer to them later through jQuery? For example, trigger events, disable etc?



        
3条回答
  •  太阳男子
    2021-01-01 13:35

    Or you can do it as an array:

    $("#myDialog").dialog({
       buttons :  [{ 
         text: "OK",
         id: "ok",
         click: function(){
             alert("clicked");
         }   
       }]
    });
    

    http://docs.jquery.com/UI/Dialog

提交回复
热议问题