1.jquery设置<span></span>标签的内容不能用val(),而要用text(),例如:
$('#spanID').val(); //can not get the value of current span
$('#spanID').val('The value of span'); //can not set the value to 'The value of span'
用text()可以实现上面的需求:
$('#spanID').text(); //canget the value of current span
$('#spanID').text('The value of span'); //canset the value to 'The value of span'
2.jquery css()操作可以设置所选dom的样式,用法如下:
$('#divId').css('width','20px');
上面是设置一个属性,如果需要设置多个属性,写法如下:
$('#divId').css({
'width':'30px',
'height':'20px'
});