javascript - I want to select the main div -


my , down arrows in div couple of divs down , image. need move div class name handle, when click arrows. if put handle in selector code works fine, don't want click handle want able click images can't seem selector go high enough.

<script> $(document).ready(function(){     $('.moveup2').click(function(){         var diveitem = $(this).parent();         if (diveitem.prev().is('div'))         {             diveitem.insertbefore(diveitem.prev())         }     });      $('.movedown2').click(function(){         var diveitem = $(this).parent();         if (diveitem.next().is('div'))         {             diveitem.insertafter(diveitem.next())         }     })  }); </script>         <div style="background-color: #dceaf4;" class="handle">         <div style="float:left;"><b class="order_interaction" id="interactionorder">{{order}}.</b>&#160;</div>         <div style="float:left;"><b id="interactiontype">{{type}}</b></div>         <div style="width:100%; text-align:right;">             <div style="text-align:right;">                  <a href="#" class="interactioncomments">                     <img style="cursor:pointer;" title="comments" src="img/messages.png"/>                 </a> &nbsp;&nbsp;&nbsp;                  {{#if showcontrols}}                     <a class="moveup_interaction">                         <img style="cursor:pointer;" src="img/arrow_up_blue.png" class="moveup2" title="move up">                     </a>                      <a class="movedown_interaction">                         <img style="cursor:pointer;" src="img/arrow_down_blue.png" class="movedown2" title="move down">                     </a>                      <a class="del_interaction">                         <img style="cursor:pointer;" src="img/delete.png" class="delete" title="delete">                     </a>                 {{/if}}              </div>          </div>     </div> 

solved problem on own , thought share answer.

$('.moveup2').click(function(){     var diveitem = $(this).parents('div:eq(3)');     if (diveitem.prev().is('div'))     {         diveitem.insertbefore(diveitem.prev())         } });  $('.movedown2').click(function(){     var diveitem = $(this).parents('div:eq(3)');     if (diveitem.next().is('div'))     {         diveitem.insertafter(diveitem.next())         } }); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -