将 id 分配给 jquery 对话框按钮 [英] assign id to jquery dialog button

查看:19
本文介绍了将 id 分配给 jquery 对话框按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 jquery 对话框按钮分配一个 id.我尝试了以下方法,但它不起作用

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",
...

推荐答案

以下(似乎未记录)适用于我的 jQuery 1.8.9:

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

可以通过 $("#my-button-id") 寻址按钮

The button can be addressed via $("#my-button-id")

这篇关于将 id 分配给 jquery 对话框按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆