appendText

appendText
 点击下载
This (very) small plugins is the incestuous child of "append" and "text": it appends a new Text Node.
This is especially important when you want to append user-supplied input, because a Text Node is never interpreted as HTML.
Example:
  1. var $myLabel = $("<label/>") 
  2. append("<input type='checkbox'/>") 
  3. appendText("use HTML <a href=''>"); 
Will add to the DOM the equivalent of the following HTML:
 
  1. <label><input type='checkbox'/>use HTML &lt;a href=''&gt;</label> 

转载请注明:代码家园 » appendText

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)