Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vandan's avatar
Level 13

remove class in not working

i have delete confirmation box in which i have lots of record but when i click to delete button then hide option then i page refresh remaning all option display again i click delete then hide all how to stop all option hide in modal

here is my code

$(document).on('click','.remove_field1-email',function(e){
	e.preventDefault();
	var eid = $(this).attr('id');
	var splitData = eid.split("-");
	var fid = $('#fid-'+splitData[2]).val();
	$('#confirm_delete').click(function(){
	if(fid){
		$.ajax({
			type:'POST',
			data:{'_token':'{{csrf_token()}}','fid': fid},
			url:"{{route('fraudalert.destroy')}}",
			success:function(response){
				if (response.status == 'success') {
					printAjaxSuccessMsg(response.message);	
				} else {
					printAjaxErrorMsg(response.message);
					}	
				$("#removed_email").closest('.edit-cloned-email').remove();	
				$('#delete-fraudalert-email').modal("hide");							
				}
			});
			}
		});	
	});
0 likes
6 replies
a4ashraf's avatar

@van1310

here is remove class syntax in js

$( "p" ).removeClass( "myClass yourClass" )

//This method is often used with .addClass() to switch elements' classes from one to another, like so:

$( "p" ).removeClass( "myClass noClass" ).addClass( "yourClass" );


are you need to remove some class in your model box?

1 like
vandan's avatar
Level 13

@a4ashraf yes how to do it

i have code inside

<div class="col-xs-12 col-sm-12 col-md-12 removecloned-email" id="removed_email">
	//html
</div>

i remove whole div id remove email class

a4ashraf's avatar

@van1310

try this


$( "#removed_email" ).addClass( "hidden" );    // create hidden css if not availble

//or 

$( "#removed_email" ).remove();
1 like
vandan's avatar
Level 13

@a4ashraf i try both the scenario but in this case remove first time perfect but second time i click to remove then all option will removed can you please suggest more example?

Please or to participate in this conversation.