加载HTML页文本区域 [英] Load HTML Page In Textarea
本文介绍了加载HTML页文本区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在试图加载一个html文件到一个textarea在页面加载时。
I've been trying to load a html document into a textarea when the page loads.
我知道你可以使用AJAX负载API中的JQuery ...
I know you can use the ajax load api in JQuery...
$("#siteloader").load('startup.html');
但是,如果我尝试加载到这一点textarea的...
but if I try to load this into the textarea...
var mirror = $("#pageloader"),
input = $("#pagecode");
input.val(mirror.load('startup.html'));
我得到 [对象的对象]
,我想通是行不通的,但想我会尝试也无妨,因为我只是不知道是否会工作或不是。
I get [object Object]
which I figured wouldn't work, but thought I'd try it anyway as I just didn't know if it would work or not.
这是如何做到这将是极大的AP preciated任何帮助。
Any help on how to do this would be greatly appreciated.
推荐答案
试试这个
$(function () {
function download_to_textbox(url, el) {
$.get(url, null, function (data) {
el.val(data);
}, "text");
}
download_to_textbox("startup.html", $("#textareaID"));
});
这篇关于加载HTML页文本区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文