Instead of .show()'ing and .hide()'ing (or .toggle()'ing for that matter), is there any way to "toggle" a .remove() function?
I realize .remove() literally removes elements from the DOM, so it sounds difficult to magically replace the removed elements once they're gone, but is there a way of faking it?
Note: They must be removed from the DOM so that they are ignored by screen readers (AFAIK screen readers do not respect .show() and .hide()).
Thanks.
--- EDIT ---
OK, so .detach() might work for me. If my markup is:
<a href="#">Toggle images</a>
<p><span>Some text here</span><img src='image1.png'/><img src='image2.png'/></p>
<p><span>Some more text</span><img src='image2.png'/></p>
<p><span>Even more text</span><img src='image5.png'/><img src='image1.png'/>
<img src='image5.png'/></p>
And by clicking the anchor it would remove all images, and clicking again would restore. Using .detach() how would it work?
--- EDIT #2 ---
As thenduks pointed out, screen readers in fact do respect display: none;
which changes my question a bit. I ended up with a simple toggle code. Thanks!