jQuery操作Dom元素

操作DOM

节点文本操作

$('#test-ul li[name = python]').text();  // 获得值
$('#test-ul li[name = python]').text('设置值');  // 设置值
$('#test-ul').html();  // 获得值
$('#test-ul').html('设置值');  // 设置值

css的操作

$('#test-ul li[name = python]').css("color","red");

元素的显示和隐藏:本质display:none

$('test-ul li[name=python]').show()
$('test-ul li[name=python]').hide()

娱乐测试

$(window).width()
$(window).height()
$('test-ul li[name=python]').toggle();
posted @ 2022-02-15 15:16  摘星丶仙  阅读(24)  评论(0)    收藏  举报