It seems there is no problem with your code, mostlikely its because you try to delete the content before the dom is ready.

You can check my working example below

EDIT----

I have tried using dynamic inserted content, its works fine too. Please check if there is any error logged in your browser console log

Regarding data-role flipswitch, thats the identifier that trigger flipswitch js

$(document).ready(function(){
    $("#content").append('<div id="btn_flip3">lorem ipsum dolor sit amet consectuer adisplicing elit</div>').trigger('create');
    
    $("#js-delete").on('click', function($evt){           
        $evt.preventDefault();
        $("#btn_flip3").html("content deleted");
  });
});
#content{ margin-bottom:20px; }

.control-box{
  padding:20px;
  background:#eee;
  border:#ddd solid 1px;
}

#js-delete{
  background:red;
  color:#fff;
  display: inline-block;
  padding:4px 8px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="content"></div>

<div class="control-box"><a id="js-delete">Delete Dynamic Content</a></div>

Answer from ilmansg on Stack Overflow
🌐
jQuery
api.jquery.com › empty
.empty() | jQuery API Documentation
Description: Remove all child nodes of the set of matched elements from the DOM · This method removes not only child (and other descendant) elements, but also any text within the set of matched elements. This is because, according to the DOM specification, any string of text within an element ...
.on()
Description: Attach an event handler function for one or more events to the selected elements · The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, the .on() method provides all functionality required for attaching event ...
.each()
Description: Iterate over a jQuery object, executing a function for each matched element · The .each() method is designed to make DOM looping constructs concise and less error-prone. When called it iterates over the DOM elements that are part of the jQuery object.
Click event
Description: Bind an event handler to the "click" event · This page describes the click event. For the deprecated .click() method, see .click()
.append()
Description: Insert content, specified by the parameter, to the end of each element in the set of matched elements · The .append() method inserts the specified content as the last child of each element in the jQuery collection (To insert it as the first child, use .prepend())
🌐
W3Schools
w3schools.com › jquery › html_empty.asp
jQuery empty() Method
jQuery Overview jQuery Selectors jQuery Events jQuery Effects jQuery HTML/CSS jQuery Traversing jQuery AJAX jQuery Misc jQuery Properties ... The empty() method removes all child nodes and content from the selected elements.
Discussions

Jquery: create empty object to work with
to create an empty container use $([]) edit: Took a look at your code. Even if you create the empty object correctly, once you append to it nothing will happen. You either need to create a container for them (span, div, whatever) or you need to add to the object like so: $foo = $('#foo'); $bar = $([]); $bar=$bar.add('

text1

'); $bar=$bar.add('

text2

'); $foo.append($bar); Note: Just running .add() on an object does not change that object, just adds to the current "chain". To make it permanent you need to assign the new "chain" to the original variable. More on reddit.com
🌐 r/javascript
16
2
August 28, 2012
JQuery .empty(), .remove() or .html('')
Iam trying to delete all the code that is wrapped inside an div. Here is the code that i nedd to delete. More on stackoverflow.com
🌐 stackoverflow.com
How to create an empty JQuery element and populate it?
Update: You could use reduce to make array of inputs or jquery objects and then append that array to form element at once. More on stackoverflow.com
🌐 stackoverflow.com
Differentiating between 0 and empty field with parseFloat.
Is it possible my problem is that parseFloat returns 0.0 as NaN? Just try it in the console (F12 -> Console). > parseFloat('0.0') 0 More on reddit.com
🌐 r/javascript
5
1
August 28, 2017
🌐
GeeksforGeeks
geeksforgeeks.org › jquery › jquery-empty-method
jQuery empty() Method - GeeksforGeeks
July 10, 2023 - The empty() method is an inbuilt method in jQuery that is used to remove all child nodes and their content for the selected elements.
🌐
jQuery
api.jquery.com › jQuery
jQuery() | jQuery API Documentation
If no elements match the provided selector, the new jQuery object is "empty"; that is, it contains no elements and has .length property of 0.
Find elsewhere
🌐
jQuery
api.jquery.com › empty-selector
:empty Selector | jQuery API Documentation
Finds all elements that are empty - they don't have child elements or text.
🌐
jQuery
api.jquery.com › jQuery.isEmptyObject
jQuery.isEmptyObject() | jQuery API Documentation
Description: Check to see if an object is empty (contains no enumerable properties).
🌐
W3Schools
w3schools.com › Jquery › jquery_dom_remove.asp
jQuery Remove Elements
The jQuery empty() method removes the child elements of the selected element(s).
🌐
GeeksforGeeks
geeksforgeeks.org › jquery › explain-the-differences-between-empty-remove-and-detach-methods-in-jquery
Explain the differences between empty() remove() and detach() methods in jQuery - GeeksforGeeks
July 31, 2024 - empty() Method: It removes all the child elements from the selected element but does not remove the selected element itself. ... Example 1: This example illustrates the use of remove() method.
🌐
Tutorial Republic
tutorialrepublic.com › faq › how-to-check-if-an-input-field-is-empty-using-jquery.php
How to Check If an Input Field is Empty Using jQuery
<!DOCTYPE html> <html lang="en"> <head> <title>Check If Inputs are Empty using jQuery</title> <style> .error{ outline: 1px solid red; } </style> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $('#myForm input[type="text"]').blur(function(){ if(!$(this).val()){ $(this).addClass("error"); } else{ $(this).removeClass("error"); } }); }); </script> </head> <body> <form id="myForm"> <p><label>First Name: <input type="text"></label></p> <p><label>Last Name: <input type="text"></label></p> <p><label>Email Address: <input type="text"></label></p> </form> </body> </html>
🌐
Udemy
blog.udemy.com › home › how to use the jquery empty() method and :empty selector
How To Use The jQuery empty() Method And :empty Selector - Udemy Blog
December 4, 2019 - We’ll discuss both of them here, but we’ll start with the empty() method. The jQuery empty() method has one purpose: to clear all of the contents out of an HTML element. it doesn’t do anything else, and it doesn’t require or allow any ...
🌐
ItSolutionstuff
itsolutionstuff.com › post › -how-to-check-object-is-empty-or-not-in-jquery-javascript-example.html
How to Check Object is Empty or Not in JQuery? - ItSolutionstuff.com
January 7, 2023 - you can check your JavaScript OR jQuery object is empty or not, because we need to check many place our jQuery object is empty, null or undefined etc., So usually, we can check using $.isEmptyObject() as i explained as under.
🌐
Rick Strahl's Web Log
weblog.west-wind.com › posts › 2008 › oct › 03 › no-empty-selector-in-jquery
No Empty Selector in jQuery - Rick Strahl's Web Log
I wouldn't really recommend it, but it looks like you can get your desired behavior by commenting out the "selector = selector || document" line from jQuery.fn.init(). A better option might be to create a plugin that does the same. ... @Ariel - yes but if you know about the issue it's easy enough to work around so I'm not sure if a plug-in wouldn't be a bit of overkill... ... Funny I should come across this today, after I was just looking for a similar solution last week. I found this interesting post from John Resig recommending that you can get an empty jQuery object via an empty array $([]) ...
🌐
BitDegree
bitdegree.org › learn › best-code-editor › jquery-empty-example-1
Removing Elements With jQuery .empty: Example
Check out the jQuery empty example. The method that is used here removes the children and nodes of the elements. Read the related article for more info.
🌐
TechBytes
mundrisoft.com › home › ui/ux development › jquery › jquery: difference between remove(), empty() and detach() methods
Difference between remove(), empty() and detach() methods
September 28, 2017 - When you click on “empty()” button it will remove all content and child elements inside the yellow box only empty yellow box will display.