jquery 学习笔记

var name={//object对象
name:'jackson',age:12   //name:表示属性,jackson表示属性name的值
}

//console.log(name.name)//输出属性值
//console.log(name['name'])//输出属性值
//console.log(typeof name)//输出类型
for(var key in name){
console.log('key is '+key+' ,value is '+name[key])
//key is name ,value is jackson
//key is age ,value is 12
}

console.log(!{})//输出false

var array=[2,3,4]//定义数组
console.log(array.length) //3
console.log(typeof array)//object

array.push("45")
console.log(array.length)//4



2.函数
function sun(first,second){
console.log(arguments.length)//输出参数长度
//1
//2
}
sun(1);
sun("1",2);

3.
var username='  jaconsonn'
console.log(username.length)// 11
console.log($.trim(username).length)//  9  ,jquery的去空格函数trim

4.
$('p').css(
            {
           color:'red',
           borderColor:'#000'
             }).width(500)

5.$('<div >this is new Tag </div>').appendTo($('body'))//向body中添加元素

6.jquery插件(非常重要)

$.fn.display=function(){//定义一个jquery的方法插件,方便调用
return  this.each(function(){//返回遍历结果
this.disabled=true;//设置当前元素为不可用
});
}
$('input').display();//调用插件

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值