您的位置:首页 > Web前端 > JQuery

jQuery的基本属性

2020-04-04 12:07 1041 查看

2.window
location.href

3.jquery
是原生js的封装库,可以简化js的操作

4.选择器
基本选择器
$(‘选择器’)

$('选择器:first')
$('选择器:last')
$('选择器:eq(index)')
$('选择器').eq(index)
$('选择器').children()
$('选择器').parent()
$('选择器').parents('选择器')
$('选择器').find('选择器')

$('选择器').prev()
$('选择器').next()
$('选择器').siblings()

5.元素操作
样式操作
$(’’).css(‘key’,‘value’);
$(’’).css({key:‘val’,key:‘val’});

属性操作
$('').attr('src','val');
$('').attr({key:'value'});

$('').removeAttr('key');

$('').prop('key');

文本操作
$('').html()
$('').text()

表单值
$('').val()

类名的操作
$('').addClass('类名')
$('').removeClass('类名')

6.相关的尺寸
$(’’).width();
$(’’).height();

$('').offset();

$('').scrollLeft()
$('').scrollTop()
  • 点赞
  • 收藏
  • 分享
  • 文章举报
caiweijiancsdn 发布了48 篇原创文章 · 获赞 0 · 访问量 1021 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: