在模态弹出窗口中显示Textarea文本



我正在使用这个模式弹出代码http://www.queness.com/post/77/simple-jquery-modal-window-tutorial,并使用"Simple modal Window"链接。

如果该页上有一个文本框。我如何在模态窗口上显示文本?

该代码被用于php网站

这是未经测试的,但你可以做的是添加一些代码到模态的点击函数来抓取文本区域的文本,然后将其传递给模态本身。它应该是这样的,假设你有一个名为myTextArea:

的文本区域
$('a[name=modal]').click(function(e) {
    //Cancel the link behavior
    e.preventDefault();
    //This is the added part:
    //Get the textarea's text
    var taText = $('textarea#myTextArea').val();
    //Example - Now add the text to a span tag inside the modal
    ("#myDiv span").text(taText);
    ...

应该可以了

最新更新