實(shí)例在 p 元素的開頭插入內(nèi)容: $(".btn1").click(function(){
$("p").
定義和用法prepend() 方法在被選元素的開頭(仍位于內(nèi)部)插入指定內(nèi)容。 提示:prepend() 和 prependTo() 方法作用相同。差異在于語法:內(nèi)容和選擇器的位置,以及 prependTo() 無法使用函數(shù)來插入內(nèi)容。 語法$(selector).prepend(content)
使用函數(shù)來附加內(nèi)容使用函數(shù)在被選元素的開頭插入指定的內(nèi)容。 語法$(selector).prepend(function(index,html)) |
|