jQuery equivalent for window.document.write

蓝咒 提交于 2019-11-30 18:40:23

This will add the string "hello" right before the body closing tag. Not exactly the behavior of write, but you can do this to any element to get the content to appear where you want it.

$(document.body).append('hello');

Also available are prepend(content) and replaceWith(content) for all your insertion needs!

First, jQuery is JavaScript, it is just a library of functions to make coding easier.

Second, you should avoid the use of document.write. You should use jQuery to append the text to the DOM element you want.

Example:

$('#myDiv').append('some new text')
user2206859

Try to use this example:

table = $('#flightTypeEditTemplate').clone();
table.attr('id','');
document.write(table.html());`
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!