textarea 不显示 IE 但正在提交

发布于 2024-11-01 11:01:46 字数 2254 浏览 0 评论 0原文

我在 jQuery 和 javascript 中有以下函数来创建表单元素:

createEmail: function(title){
        var $emailForm = $('<form>',{action: 'sendEmail.php', id: 'emailForm'});
        var $table = $('<table>');

        $emailForm.append($table);
        var $tr = $('<tr>');
        $tr.append($('<td>',{text: 'Email From:'}));
        $tr.append($('<td>',{html: '<input type="text" value="" name="from"/>'}));
        $table.append($tr);

        $tr = $('<tr>');
        $tr.append($('<td>',{text: 'Email To:'}));
        $tr.append($('<td>',{html: '<input type="text" value="" name="to"/>'}));
        $table.append($tr);

        $tr = $('<tr>');
        $tr.append($('<td>',{text: 'Message Body:'}));
        $tr.append($('<textArea>',{name: 'msg', cols: 50, rows: 10,
                            text: 'Attached is the ' +title+ ' license key file.\nPlease place the file in the same directory as the "check_license.php" file for ' +title+ ' '}));
        $table.append($tr);

        $tr.append('<input type="hidden" value="'+title+'" name="title"/>');

        var $div = $('<div>').append($emailForm).dialog({
                title: 'Email ' + title + ' File',
                width: 600,
                modal: true,
                buttons: {
                    cancel: function(){
                        $(this).dialog('close');
                    },
                    send: function(){
                        $.post($emailForm.attr('action'), $emailForm.serialize(),function(data){
                            alert(data);
                            $div.dialog('close');
                        })
                    }
                },
                beforeClose: function(){
                    $(this).remove();
                }
            });
        $div.dialog('widget').css('margin','0 auto');

    }

由于某些原因,在 IE 中,文本区域没有显示,当您单击它时,对话框看起来像这样:在此处输入图像描述

但在 chrome 和 FF 中看起来很正常: 在此处输入图像描述

为什么会发生这种情况?文本区域仍然被提交到我的 php,就好像它里面有东西一样(当我在 IE8 中使用开发工具时,它说里面有内容)

那么为什么在 IE 中它不显示可编辑的文本区域呢?

谢谢....

i have the following function in jQuery and javascript that creates a form element:

createEmail: function(title){
        var $emailForm = $('<form>',{action: 'sendEmail.php', id: 'emailForm'});
        var $table = $('<table>');

        $emailForm.append($table);
        var $tr = $('<tr>');
        $tr.append($('<td>',{text: 'Email From:'}));
        $tr.append($('<td>',{html: '<input type="text" value="" name="from"/>'}));
        $table.append($tr);

        $tr = $('<tr>');
        $tr.append($('<td>',{text: 'Email To:'}));
        $tr.append($('<td>',{html: '<input type="text" value="" name="to"/>'}));
        $table.append($tr);

        $tr = $('<tr>');
        $tr.append($('<td>',{text: 'Message Body:'}));
        $tr.append($('<textArea>',{name: 'msg', cols: 50, rows: 10,
                            text: 'Attached is the ' +title+ ' license key file.\nPlease place the file in the same directory as the "check_license.php" file for ' +title+ ' '}));
        $table.append($tr);

        $tr.append('<input type="hidden" value="'+title+'" name="title"/>');

        var $div = $('<div>').append($emailForm).dialog({
                title: 'Email ' + title + ' File',
                width: 600,
                modal: true,
                buttons: {
                    cancel: function(){
                        $(this).dialog('close');
                    },
                    send: function(){
                        $.post($emailForm.attr('action'), $emailForm.serialize(),function(data){
                            alert(data);
                            $div.dialog('close');
                        })
                    }
                },
                beforeClose: function(){
                    $(this).remove();
                }
            });
        $div.dialog('widget').css('margin','0 auto');

    }

For some reason in IE the text area is not showing up and the dialog looks like this when you click on it:enter image description here

but in chrome and FF it looks normal:
enter image description here

why is this happening? the text area still gets submitted to my php as if it has something in it (and when i use dev tools in IE8 it says there is content in it)

So why in IE does it not display an editable textarea?

Thanks....

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

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

发布评论

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

评论(2

菩提树下叶撕阳。 2024-11-08 11:01:46

如果我没读错的话,看起来您是将文本区域附加到行而不是单元格中。

If I'm reading correctly, it looks like you're appending your textarea to the row instead of the cell.

蹲在坟头点根烟 2024-11-08 11:01:46

也许 IE 无法识别

Perhaps IE is not recognizing the <textArea>, try <textarea>.

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