节点操作-jQuery课件

节点操作方法说明示例removeAttr()移除某元素的属性$(‘li’).removeAttr(‘title’):移除元素的属性title append()向元素内部追加内容追加前:first jquery app: $(‘#div1’).append(‘hello world ’)追加后:first jquery app:hello world prepend()向每个匹配的元素前置内容添加前:first jquery app: $(‘#div1’).prepend(‘hello world ’)添加后: hello world first jquery app: prependTo()将匹配的元素前置倒指定的元素,与prepend()正好相反原始标记:first jquery app:;追加:$(‘hello world ’).prependTo(‘div’)追加后: hello world first jquery app: after()在匹配的元素后插入内容原始标记:first:插入内容:$(‘p’).after(‘选择器’);插入后:first 选择器 before()在匹配的元素前插入内容原始标记:first:插入内容:$(‘p’).before(‘选择器’);插入后: 选择器first insertBefore()将匹配的元素插入到指定的元素前原始标记:first:插入内容:$(‘选择器’).insertBefore(‘p’);插入后:选择器first remove()从DOM中删除所有匹配的元素$(‘ul li:eq(1)’).remove():删除中的第2个子元素empty()清空元素的所有后代节点$(‘div’).empty():清空元素内的所有内容,但元素本身还保留clone()复制节点$(‘ul li’).clone().appendTo(‘ul’):复制元素并且将其追加到元素中replaceWith()替换节点$(‘p’).replaceWith(‘first’):用first替换元素wrap()包装匹配的节点,每个匹配的节点都被一个新元素包装起来包装前:选择器动画包装:$(‘strong’).wrap(‘’)包装后:选择器动画
ppt 文件大小:1.59MB