jQuery 文檔操作 - prepend() 方法
定義和用法
prepend() 方法在被選元素的開頭(仍位于內(nèi)部)插入指定內(nèi)容。
提示:prepend() 和 prependTo() 方法作用相同。差異在于語法:內(nèi)容和選擇器的位置,以及 prependTo() 無法使用函數(shù)來插入內(nèi)容。
語法
$(selector).prepend(content)
參數(shù) | 描述 |
---|---|
content | 必需。規(guī)定要插入的內(nèi)容(可包含 HTML 標(biāo)簽)。 |
使用函數(shù)來附加內(nèi)容
使用函數(shù)在被選元素的開頭插入指定的內(nèi)容。
語法
$(selector).prepend(function(index,html))
參數(shù) | 描述 |
---|---|
function(index,html) | 必需。規(guī)定返回待插入內(nèi)容的函數(shù)。
|
posted on 2014-04-10 13:31 順其自然EVO 閱讀(243) 評論(0) 編輯 收藏 所屬分類: jQuery