Answers for "remove the selected item from select option"

6

jquery remove option from select by value

$("#FIELDID option[value='X']").remove();
Posted by: Guest on February-27-2020
0

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>
Posted by: Guest on February-23-2022
-2

delete div based on select

$('#record_nav ul li').on('click', function(e){
      $('#record_nav ul li.selected').removeClass('selected');
      $(this).addClass('selected');
      $('.content').hide();
      var id = $(this).data('target');
      $(id).show();
  });
Posted by: Guest on May-24-2020

Code answers related to "remove the selected item from select option"

Code answers related to "Javascript"

Browse Popular Code Answers by Language