zzzzy09

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
// $(document).ready(fucntion(){....})   可以简写成 $(function(){...})

//常用选择器
// id 选择器  元素  类选择器

//常用方法
// 操作样式,操作内容,操作属性
//css text html attr val

//常用事件
//点击事件 鼠标悬浮   鼠标离开


$(function () {
    //id 选择器
    $('#btn').css({'backgroundColor':'red'});
   //元素选择器
    $('li').text('ceshi');
    // 类选择器
    $('.box').css({'backgroundColor':'red','height':'200px','width':'200px'});

    console.log($('li').text());
    console.log($('li').css('color'));
    console.log($('li').html());
    console.log($('li').attr('src'));

    //点击事件
    $('#btn').click(function () {
        $(this).hide();
    });
    // 鼠标悬浮
    $('#btn').mouseover(function () {
        $(this).css("background-color","yellow");
    });
    // 鼠标离开
    $('#btn').mouseout(function () {
        $(this).css("background-color","blue");
    });
});

 

posted on 2021-08-26 16:54  zzzzy09  阅读(10)  评论(0编辑  收藏  举报