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

发布于 2024-12-24 03:42:11 字数 260 浏览 0 评论 0原文

我正在使用此模式弹出代码 http://www.queness.com /post/77/simple-jquery-modal-window-tutorial 并使用“简单模态窗口”链接。

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

该代码正在 php 网站上使用。

Am using this modal popup code http://www.queness.com/post/77/simple-jquery-modal-window-tutorial and using the "Simple Modal Window" link.

If there was a textarea box on that page. How would I display the text on the Modal Window?

The code is being used on a php website.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨后彩虹 2024-12-31 03:42:11

这是未经测试的,但您可以做的是向模态的单击函数添加一些代码以获取文本区域的文本,然后将其传递到模态本身。假设您有一个名为 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);

    ...

希望可以做到这一点。

This is untested but what you could do is add some code to the modal's click function to grab the textarea's text and then pass it in to the modal itself. It would be something like this, assuming you have a textarea called 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);

    ...

That should hopefully do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文