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();