写法
来源:互联网 发布:云和山的彼端 mac 编辑:程序博客网 时间:2024/06/09 21:08
$("span").css('opacity', '0.7');
$("span").css("color", "red");
$("span").css({
"fontSize" : 'xx-large',
backgroundColor: 'yellow'
}); //两种写法都可以
$("span").text();//获取节点元素值 p span ul 标签
$("span").text("some text");// 给节点元素赋值
$("span").attr("title");//获取属性值class 、id
$("span").attr("title", "你是我的"); //给属性赋值
$("span").attr({
ai : '爱',
ia : '爱'
}); //多属性赋值
$(this).val(); //val()获取元素的值
$("#single").val("選擇二號");
$("#single2").val(["一號","四號"]); //多属性赋值
$("span").addClass("fontSize"); //增加样式
$("span").removeClass(); //移除样式
$("ul li:eq(2)").click(function(event) {
$(this).clone(true).appendTo($("ul")); //复制第三个 li 元素包括事件、值、属性,追加到ul 节点元素的后面
//$("<strong>还是我</strong>").replaceAll("span"); 将节点元素 span 标签替换成<strong>还是我</strong>标签
$("strong").wrap('<b></b>');//将选中的strong标签外边嵌套一个 b 标签
$("ul li:eq(1)").height($("span").height()).css('backgroundColor', 'yellow'); //将span标签的高度赋给ul 中的第二个li 元素
});
$("span").css("color", "red");
$("span").css({
"fontSize" : 'xx-large',
backgroundColor: 'yellow'
}); //两种写法都可以
$("span").text();//获取节点元素值 p span ul 标签
$("span").text("some text");// 给节点元素赋值
$("span").attr("title");//获取属性值class 、id
$("span").attr("title", "你是我的"); //给属性赋值
$("span").attr({
ai : '爱',
ia : '爱'
}); //多属性赋值
$(this).val(); //val()获取元素的值
$("#single").val("選擇二號");
$("#single2").val(["一號","四號"]); //多属性赋值
$("span").addClass("fontSize"); //增加样式
$("span").removeClass(); //移除样式
$("ul li:eq(2)").click(function(event) {
$(this).clone(true).appendTo($("ul")); //复制第三个 li 元素包括事件、值、属性,追加到ul 节点元素的后面
//$("<strong>还是我</strong>").replaceAll("span"); 将节点元素 span 标签替换成<strong>还是我</strong>标签
$("strong").wrap('<b></b>');//将选中的strong标签外边嵌套一个 b 标签
$("ul li:eq(1)").height($("span").height()).css('backgroundColor', 'yellow'); //将span标签的高度赋给ul 中的第二个li 元素
});
阅读全文
1 0
- 写法
- Makefile写法
- 批处理文件写法
- 参考文献写法
- 批处理文件写法!
- 过滤器写法
- dll 写法
- 备忘录写法
- CamelCase写法
- 参考文献写法
- connectionstring写法
- 如此写法
- BootSector写法
- Grub写法
- 回文写法
- makefile写法
- 插件写法
- SqlParameter[]写法
- 1013.Digital Roots
- lintcode--字符串置换
- 把字节数B转换为KB,MB,GB的方法
- hdu2086
- mysql 性能排查3板斧
- 写法
- Webview常用的方法
- python编程常用方法总结
- uname命令与uuname命令
- 利用外键关系实现多表关联更新
- 30岁还一事无成,你该怎么办?
- yii excle导出 项目实战
- 全面的freemarker教程
- 【HTCVR】VRTK插件案例分析之001~010