jQuery中[name^=value1][name$=value2]两个选择器能合并起来用吗
发布网友
发布时间:2022-10-17 08:05
我来回答
共2个回答
热心网友
时间:2023-10-29 01:17
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script class="jquery library" src="/js/sandbox/jquery/jquery-1.8.2.min.js" type="text/javascript"></script>
<title>
RunJS 演示代码
</title>
<style>
div{
border:1px solid black;
}
#div1{
width:40%;
}
</style>
<script>
jQuery(function($){
console.log($("[name^=value1][name$=value2]").css("background","blue"));
})
</script>
</head>
<body>
<div name="value1dddvalue2">
div1
</div>
<div name="value1dddvalu">
div2
</div>
<div name="value1dddadfadfadf23332value2">
div1
</div>
</body>
</html>
热心网友
时间:2023-10-29 01:17
$('input[name^=value1][name$=value2]')