书签 分享 收藏 举报 版权申诉 / 18

类型了解了这些才能开始发挥jQuery的威力.docx

  • 文档编号:11347126
  • 上传时间:2023-05-31
  • 格式:DOCX
  • 页数:18
  • 大小:23.47KB

Goodbye

$(".inner").wrap("

");

Hello

Goodbye

 

.wrapAll(wrappingElement) 把所有匹配对象包裹在同一个HTML结构中

WrapanHTMLstructurearoundallelementsinthesetofmatchedelements.

Hello

Goodbye

$(".inner").wrapAll("");

Hello

Goodbye

 

.wrapInner(wrappingElement) /.wrapInner(function(index)) 包裹匹配元素内容,这个不好说,一看例子就懂

WrapanHTMLstructurearoundthecontentofeachelementinthesetofmatchedelements.

Hello

Goodbye

$(".inner").wrapInner("");

Hello

Goodbye

.unwap() 把DOM元素的parent移除

RemovetheparentsofthesetofmatchedelementsfromtheDOM,leavingthematchedelementsintheirplace.

pTags=$("p").unwrap();

属性方法

.val() 获取元素的value值

Getthecurrentvalueofthefirstelementinthesetofmatchedelements.

$("input:

checkbox:

checked").val();

.val(value)/.val(function(index,value)) 为元素设置值,index和value同样是指在为集合中每个元素设置的时候该元素的index和原value值

Setthevalueofeachelementinthesetofmatchedelements.

$("input").val(‘hello’);

$("input").on("blur",function(){

$(this).val(function(i,val){

returnval.toUpperCase();

});

});

 

.attr(attributeName) 获取元素特定属性的值

Getthevalueofanattributeforthefirstelementinthesetofmatchedelements.

vartitle=$("em").attr("title");

.attr(attributeName,value)/.attr(attributesJson)/.attr(attributeName,function(index,attr)) 为元素属性赋值

Setoneormoreattributesforthesetofmatchedelements.

$("#greatphoto").attr("alt","BeijingBrushSeller");

$("#greatphoto").attr({

alt:

"BeijingBrushSeller",

title:

"photobyKellyClark"

});

$("#greatphoto").attr("title",function(i,val){

returnval+"-photobyKellyClark";

});

 

.prop(propertyName) 获取元素某特性值

Getthevalueofapropertyforthefirstelementinthesetofmatchedelements.

$(elem).prop("checked")

.prop(propertyName,value)/.prop(propertiesJson)/.prop(propertyName,function(index,oldPropertyValue)) 为元素特性赋值

Setoneormorepropertiesforthesetofmatchedelements.

$("input").prop("checked",true);

$("input[type='checkbox']").prop("checked",function(i,val){

return!

val;

});

$("input[type='checkbox']")

举报
举报
版权申诉
版权申诉
word格式文档无特别注明外均可编辑修改;预览文档经过压缩,下载后原文更清晰! 立即下载
配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
了解 这些 才能 开始 发挥 jQuery 威力
提示  冰点文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:了解了这些才能开始发挥jQuery的威力.docx
链接地址:https://www.bingdoc.com/p-11347126.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2


收起
展开