<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>多选一切换</title>
<style>
div{
width: 100px;
height: 100px;
background-color: pink;
}
</style>
<script src="js/jquery-1.8.2.min.js"></script>
<script>
$(function(){
$('div').click(function(){
$('div').find("span").each(function(i,element){
let test = $(element).attr('test');
// test = test.replace("_","_s");
test = test.replace("_s","_");
$(element).attr("test",test)
console.log($(this).attr("test"))
})
let sele = $(this).find('span').attr("test");
sele = sele.replace("_","_s");
console.log("当前的"+sele)
// console.log("改变")
$(this).find('span').attr("test",sele)
})
// console.log($('span').attr('test'))
})
</script>
</head>
<body>
<div><span test="image0_s">0</span></div>
<div><span test="image1_">1</span></div>
<div><span test="image2_">2</span></div>
<div><span test="image3_">3</span></div>
</body>
</html>
09-09
1992