jquery case-interlaced color change

jquery case-interlaced color change

Insert picture description here

	<!--导入js-->
	<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
	<script type="text/javascript">
		$(function () {
    
    
			$("tr:gt(1):even").css("background-color","red");
			$("tr:gt(1):odd").css("background-color","blue");
        });

jquery case-select all unselect all

Insert picture description here

		<script type="text/javascript">
			$(function () {
    
    
				//1:给全选框绑定点击事件
				$("#checkedAllId").click(function () {
    
    
					//2:获取全选框的选中状态
                    var flag = $("#checkedAllId").prop("checked");
                    //3:将全选框状态赋值给所有的行选框
					$(".itemSelect").prop("checked",flag);
                });
            });
		</script>

jquery case-QQ expression

Insert picture description here

<script type="text/javascript">
        //this是js对象
        //1:给所有的标表情图片添加点击事件
        $("li img").click(function () {
    
    
            //2:将每一张图片,克隆一份添加到请发言的后边
            var newImgEle =  $(this).clone();
            $(".word").append(newImgEle);
            //3:给每一张克隆的图片绑定一个点击事件
            newImgEle.click(function () {
    
    
                //点击之后,删除自己
                $(this).remove();
            });
        });
    </script>

jquery summary

》》1: Don’t memorize it by rote, just understand it.
》》2: Check the document when you need a function.
》》3: The more you use, the more familiar

Guess you like

Origin blog.csdn.net/qq_37924905/article/details/108658480