Note that there are some explanatory texts on larger screens.

plurals
  1. POChange / Revert back some elements by jquery dependending on what button is clicked
    text
    copied!<p>I have a page with a list and some thumbnails inside. The (simplified) html of each <em>li</em> when the page loads:</p> <pre><code>&lt;a class="img" href="http://exemple.com"&gt; &lt;img src="http://exemple.jpg" onmouseover="startFlipBook(...);" onmouseout="endFlipBook(...);"&gt; &lt;/a&gt; </code></pre> <p>In that page, I have an "Edit" Button. When I click on that button, I load the jquery UI sortable plugin (so the user is able to sort the list). With javascript, I remove the <em>mouseover</em> and the <em>mouseout</em> on the images. I also disable the click on all <em>a href</em>. I do:</p> <pre><code>$("#edit").click(function() { $( "img" ).removeAttr('onmouseover').removeAttr('onmouseout'); $( "a, .wrap" ).css('cursor','move'); $( "a").click(function(){return false;}); }); </code></pre> <p>So far, it's working like I want (not sure it's the best way of doing it though). </p> <p>Now, in edit mode, I have a "Cancel" button. Hitting that button should put back the <em>mouseover</em> and the <em>mouseout</em> on the images, and the links need to work again.</p> <p>This is where my code is not woking. I do :</p> <pre><code>$("#cancel").click(function() { //No idea how I can get back my initial mouseover and mouseout with the correct parameter $( "a, .wrap" ).css('cursor','auto'); $( "a" ).click(function(){return true;}); }); </code></pre> <p>The links stay unclickable, the cursor is wrong and I don't know how to put back my <em>mouseover</em> event.</p> <p>Any help please?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload