I think the value of name in this example is strange, but somebody ask me this question.
"How to NOT select the select dropdown list which are with the string 'temp' ?"
that mean select the 1st and 3rd dropdown list only.
I think this is about "Select all select-elememt but exclude some including specific string" and get the syntax from stackoverflow
<html>
<head>
<title>jquery demo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<select name="ABC[0].xxx"><option>1</option></select>
<select name="ABC['temp'].xxx"><option>2</option></select>
<select name="ABC[1].xxx"><option>3</option></select>
<script>
$( document ).ready(function() {
$("select:not(select[name*='temp'])").css("border", "1px solid red");
});
</script>
</body>
</html>
Result:
Reference:
No comments :
Post a Comment