1.绑定点击事件
//class
$('.class').on('click',function(ev){
//取当前的值用$(this)
let target=ev.target;
});
//id
$('#id').on('click',function(ev){
})
2.移除绑定事件
$(".class").unbind();
$("#id").unbind();
3.加attribute
$(this).attr('id','123456')
4.获取attribute
let id =$(this).attr('id')
5.判断有没有class
$(this).hasClass('active')
6.加class
$(this).addClass('active');
7.删class
$(this).removeClass('active');
8.查找所有calss
$('.class').each(function(){
$(this)
}
9.下一个兄弟节点
$(this).next()
注:鄙人一般使用原生js多一些,有时候原生js不太好做的用jquery来替代,但是主要还是原生js