[英]Create new element in cheerio
What is the best way to create a new element in cheerio? 在cheerio中创建新元素的最佳方法是什么?
May be: 也许:
cheerio.load('<li>something in here!</li>')
or 要么
$('li', '<li>bla, bla, bla, ...</li>')
Neither load
nor the context string actually create HTML. load
和上下文字符串都不会实际创建HTML。 They serve as a starting point for creating a virtual DOM. 它们是创建虚拟DOM的起点。
Refer to the Manipulation section in the documentation for methods of injecting into the DOM. 有关注入DOM的方法, 请参阅文档中的“操作”部分 。 Namely, the following methods are provided for injection: 即,提供以下注射方法:
append
appendTo
prepend
prependTo
after
insertAfter
before
insertBefore
replaceWith
html
wrap
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.