<ul class="selectMessageUl"></ul>
Copy the code
.selectMessageUl { padding: 0; margin: 0; list-style-type: none; height: 476px; overflow-x: scroll; } .selectMessageUl li { height: 34px; display: flex; align-items: center; align-content: center; padding-left: 10px; }.selectmessageul li:hover,.forselectli {background: rgba(242,244,247,1); } .selectMessagecheck { margin: 0 5px 0 0 ! important; } .selectMessagetxt { width: 340px ! important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block ! important; font-weight: normal ! important; margin: 0 ! important; }Copy the code
for (var i = 0; i < 30; I ++) {var list = '<li><input type =" checkbox" name =" selectMessagecheck" value=" logistics related issues' + I + '" id =" logistics related issues' + I + '" class="selectMessagecheck" onclick="selectMessagecheck(this)" ><label class="selectMessagetxt" for=" logistics related issues' + I + $(".selectMessagecheck ").append(list)} function selectMessagecheck(obj) {var forSelect = $(".selectMessagecheck"); for (var i = 0; i < forselect.length; i++) { forselect[i].checked = false; } obj.checked = true; $(obj).parent().addClass("forselectli").siblings().removeClass("forselectli") }Copy the code