jQuery

作者: 長又长 | 来源:发表于2017-05-23 21:19 被阅读0次

[TOC]

优点:写的更少,做的更多

选择器

id #id值

开始结束之间使用.html
赋值则使用传参


alert(aaa.html());
    var content=$('#content');
    content.html(aaa.html());

类选择器

.类名


  var ccc= $('.ccc:checked');

    ccc.each(function(){
        content.append("<br>"+$(this).val());
        
    });

标签属性选择器

优先级

id>类 >标签属性选择器

jQuery 设置样式

  • 第一种 .css
content.css("color", "red");
  • 第二种 .addClass
<style type="text/css">

.abc{
 background-color: gary;
 font-size: 40px;
 color:green;
}
</style>
 content.addClass("abc");

相关文章

网友评论

      本文标题:jQuery

      本文链接:https://www.haomeiwen.com/subject/ctwgxxtx.html