title: jQuery event on attribute change
body: <p>I need a function to run when a divs data-page-index attribute changes</p>
  
  <pre><code>  var active = $('.swipeview-active'),
        dpi =  parseInt(active.attr('data-page-index')),
        left = $('[data-page-index="' +prev+ '"]').children("img").eq(0),
        right = $('[data-page-index="' +next+ '"]').children("img").eq(0);
  
      $(active.attr('data-page-index')).change(function(){
  
      right.clone( true ). css({'z-index': 5}). fadeIn(2000).appendTo('#right');
      left.clone( true ). css({'z-index': 5}). fadeIn(2000).appendTo('#left');
      });
  </code></pre>
  
  <p>I tried the change() function but that only seems to work with input fields,</p>
  
  <pre><code>    $(active.attr('data-page-index')).change(function(){    
  </code></pre>
  
  <p>is there another way of achieving this? Thanks.</p>