Hey,
I'm wanting to change a div to another one onclick and then back again
when its clicked again.
I've managed to get it to change the div on the first click but
clicking it again doesn't do anything.

Here is the HTML

<div id="maximize" onClick="onMaximize()"></div>
<div id="restore" onClick="onRestore()"></div>

and the jquery code

 $(document).ready(function(){
    $('#maximize').click(function () {
      $(this).replaceWith("<div id=\"restore\" onClick=\"onRestore()
\"></div>");
    });
     $('#restore').click(function () {
      $(this).replaceWith("<div id=\"maximize\" onClick=\"onMaximize()
\"></div>");
    });
 });


As you can see there is also an onclick event on the div which works
and the div changed from the maxi to the restore, but it doesn't work
back nor does the onClick event onRestore button work

What I'm trying to do is work on an AIR application with a custom
chrome, I've got the chrome all built and everything else is working
how I want except for the Maximize/Restore button I want it to change
to restore when maximized is clicked and then change back to maximized
when restore is clicked.

I have tried searching but I haven't found anything that I want
specifically to do and I don't know jquery all that well at all so I
can't really change anything to what I want (but not for lack of
trying, this is the closes I've gotten)

Reply via email to