I basically have the same problem in this questions:
Flash Video still playing in hidden div
I've used the .remove jquery call and this works. However, I have previous/next buttons when a user scrolls through hidden/non-hidden divs. What I need to know is, once I remove the flash object, is there a way to get it back other than refreshing the page?
Basically, can this be handled client side or am I going to need to implement some server side handling.
detach() won't work because the flash video continues to play.
I can't just hide it because the video continues to play as well.
jQuery remove() Method The remove() method removes the selected elements, including all text and child nodes. This method also removes data and events of the selected elements. Tip: To remove the elements without removing data and events, use the detach() method instead.
remove() removes the matched elements from the DOM completely. detach() is like remove() , but keeps the stored data and events associated with the matched elements.
jQuery uses: . append(); and . remove(); functions to accomplish this task. We could use these methods to append string or any other html or XML element and also remove string and other html or XML elements from the document.
Use . remove() when you want to remove the element itself, as well as everything inside it. In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.
$myVariable = $("#removeMe").detach();
The .detach()
function is explicitly made to take something out of the DOM to be put back in later. It's a good'n.
API Ref: http://api.jquery.com/detach/
Have you tried:
var clone = $("#someDiv").clone(true);
$("#someDiv").remove();
You can assign it to a variable:
var undo = $('#someDiv')
Then use the value of "undo" to re-insert the item.
$('#placeholder').html(undo)
Perhaps you're better off hiding it instead of removing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With