JQuery自学记录3——对页面内容及样式的操作
2012-09-24 10:50
225 查看
1、对HTML内容改变
$(selector).html(content):改变对象的html内容为content
$(selector).append(content):在对象的html内容后添加content
$(selector).prepend(content):在对象的html内容之前添加content
$(selector).after(content):在对象的标签之后添加内容content
$(selector).before(content):在对象的标签之前添加内容content
还有很多,详见:http://www.w3school.com.cn/jquery/jquery_ref_manipulation.asp
2、对CSS样式的改变
$(selector).css(name,value):设置对象css为name的值为value
$(selector).css({properties}):设置对象css样式为properties
$(selector).css(name):返回对象css为name的值
$(selector).height(value):设置对象height值
$(selector).width(value):设置对象width值
还有一些,详见:http://www.w3school.com.cn/jquery/jquery_ref_css.asp
$(selector).html(content):改变对象的html内容为content
$(selector).append(content):在对象的html内容后添加content
$(selector).prepend(content):在对象的html内容之前添加content
$(selector).after(content):在对象的标签之后添加内容content
$(selector).before(content):在对象的标签之前添加内容content
还有很多,详见:http://www.w3school.com.cn/jquery/jquery_ref_manipulation.asp
2、对CSS样式的改变
$(selector).css(name,value):设置对象css为name的值为value
$(selector).css({properties}):设置对象css样式为properties
$(selector).css(name):返回对象css为name的值
$(selector).height(value):设置对象height值
$(selector).width(value):设置对象width值
还有一些,详见:http://www.w3school.com.cn/jquery/jquery_ref_css.asp
相关文章推荐
- 这两天使用jquery-mobile写手机页面遇到的append样式不生效,以及listview内容显示不完解决方法
- jquery 与javascript关系 ①取元素 ②操作内容 ③操作属性 ④操作 样式 ⑤ 事件 点击变色
- jQuery:属性 样式 内容;表单中实现用户密码判断登录新页面
- PHP Jquery 代码操作 内容 属性 样式 事件 Json数据
- JQuery元素属性和样式操作、以及设置元素和内容
- 记录--前端 页面 jquery 被点击按钮修改样式 其他默认
- 2016/4/1 jquery 与javascript关系 ①取元素 ②操作内容 ③操作属性 ④操作 样式 ⑤ 事件 点击变色
- jQuery ---页面内容,样式,控制属性
- 1.jQuery基础语法 2.jQuery选择器、操作页面文档元素 3.jqueryDOM操作 4.jqueryCSS操作 5.Jquery事件 6.Jquery动画
- jquery 对json数据的操作,增加、删除记录
- jquery.cookies 操作不同页面的Cookie
- 从零开始学习jQuery (四) 使用jQuery操作元素的属性与样式
- jquery 打印页面指定内容
- JQuery DataTables Editor---页面内容修改&&数据库信息修改 (1)
- JQuery操作iframe父页面与子页面的元素与方法
- iOS 直接改变.html后缀的链接所对应的html页面样式,并获取html的标题,图片地址,id,内容
- jQuery学习整理 (3) 使用jQuery操作元素的属性与样式
- jquery模仿微博向下滚动到页面底部时实时加载新内容
- (转)基于Metronic的Bootstrap开发框架经验总结(9)--实现Web页面内容的打印预览和保存操作
- jQuery实现滚动时动态加载页面内容