remove all options from select jquery
$('#mySelect')
.empty()
Select Options From List Select Box & Remove By Name
<!DOCTYPE html>
<html>
<head>
<div class="formi" data-type="category">
<div>
<select>
<option value="0">select an option</option>
<option value="1">sami lore</option>
<option value="2">value 2</option>
<option value="3">luminu dore</option>
<option value="4">value 4</option>
</select>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(".formi[data-type='category'] select").on('click',function(){
var list = [];
$(".formi[data-type='category'] select option").each(function()
{
const item = $(this).text();
const indexOf = item.indexOf('value');
if (indexOf == -1){
var thisVal = $(this).val();
$(this).remove();
}
});
});
</script>
</head>
<body>
<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
<button>Get External Content</button>
</body>
</html>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us