2010-01-28 42 views
2

我试图暗示一个确认框,但我需要使用html编辑文本。所以,我发现jQuery的“确认覆盖”在这里: http://www.ericmmartin.com/projects/simplemodal-demos/需要帮助在jQuery模式对话框中输入html

他提到这里大约有造型HTML字符串: http://www.ericmmartin.com/projects/simplemodal/

但我不inderstand凡在我的功能,我该怎么办呢?这里是功能:

$(document).ready(function() { 
    $('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) { 
     e.preventDefault(); 

     // example of calling the confirm function 
     // you must use a callback function to perform the "yes" action 
     confirm("Continue to the SimpleModal Project page?", function() { 
      window.location.href = 'http://www.ericmmartin.com/projects/simplemodal/'; 
     }); 
    }); 
}); 

function confirm(message, callback) { 
    $('#confirm').modal({ 
     closeHTML:"<a href='#' title='Close' class='modal-close'>x</a>", 
     position: ["20%",], 
     overlayId:'confirm-overlay', 
     containerId:'confirm-container', 
     onShow: function (dialog) { 
      $('.message', dialog.data[0]).append(message); 

      // if the user clicks "yes" 
      $('.yes', dialog.data[0]).click(function() { 
       // call the callback 
       if ($.isFunction(callback)) { 
        callback.apply(); 
       } 
       // close the dialog 
       $.modal.close(); 
      }); 
     } 
    }); 
} 

谢谢你的帮助!

基本上而不是确认(“继续到SimpleModal项目页面?”,()的函数我必须疗法无序列表服务(条款)

回答

1

您是否尝试过通过HTML作为第一个参数?

您的代码应该做工精细这样

confirm('<ul><li>somedata</li><li>moredata</li></ul>', function(){}); 

,因为您的确认功能追加message变量。

+1

这做到了。AWES青梅。非常感谢! – Joel 2010-01-28 04:08:31